<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>P小二</title><description>AI Coding、AI Agents、Robotics AI 与 AI 安全，以及技术与创业笔记。</description><link>https://pxiaoer.blog/</link><language>zh-CN</language><item><title>重读产品课笔记（三）：一切的原点是需求</title><link>https://pxiaoer.blog/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%89-%E9%9C%80%E6%B1%82%E4%B8%8E%E4%BE%9B%E9%9C%80/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%89-%E9%9C%80%E6%B1%82%E4%B8%8E%E4%BE%9B%E9%9C%80/</guid><description>重读王慧文产品课 31 篇笔记的收官篇：需求是最稀缺的资源，供需关系决定一切。再用整套框架从头到尾分析一个今天的 AI 生意——云端个人 AI 助理，到底值不值得做。</description><pubDate>Sat, 26 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;100 天 100 篇，第 5 篇。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%80-%E4%BB%80%E4%B9%88%E7%94%9F%E6%84%8F%E8%83%BD%E5%81%9A%E5%A4%A7/&quot;&gt;产品课笔记重读&lt;/a&gt;的最后一篇。前两篇盘了什么生意能做大、什么时候进、进去怎么打，今天收尾：这门课最值钱的部分——需求与供需。最后，我用三篇盘下来的整套框架，从头到尾分析一个今天的 AI 生意。&lt;/p&gt;
&lt;h2 id=&quot;需求是最稀缺的资源&quot;&gt;需求是最稀缺的资源&lt;/h2&gt;
&lt;p&gt;中文里的”需求”对应三个词：Need 是用户原始的动机，Requirement 是由此产生的产品设计要求，Demand 是产品做出来之后的市场需求量。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm25/&quot;&gt;需求的不可满足性&lt;/a&gt;这篇泼了一串冷水：大部分需求当下无法满足；能满足的里面，ROI 为正的是少数；ROI 为正的里面，能养活一个可规模化团队的更少；能支撑一家公司独立存在的，凤毛麟角。所以可以默认：&lt;strong&gt;任何一个时间点上，社会上都不存在靠谱的大商业机会。&lt;/strong&gt; 听着丧，其实是在教你尊重需求——真正有效的大需求非常稀缺。&lt;/p&gt;
&lt;p&gt;需求本身很少凭空出现，变的往往是可行性。&lt;a href=&quot;/posts/2021/pm26/&quot;&gt;机会窗&lt;/a&gt;像天空中的闪电：需求的电荷团和可行性的电荷团，至少有一个在不断积累，攒够了才劈那一下。最伟大的需求往往一直强烈、一直广泛，只是实现太难，比如无人驾驶。面对这样的需求，要回答三个问题：是不是根本实现不了？是不是其实没有这个需求？为什么是现在？&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm27/&quot;&gt;识别需求&lt;/a&gt;的办法，是去研究”成功的失败”。从个人主页、ChinaRen 主页大巴、博客，到微博、Facebook、抖音，内容形态越丰富，用户越下沉；直播跟着 3G、4G、5G 一代代长大，相册从纸质、光盘、电脑一路搬到线上。每一代都在问同一个问题：前人为什么没成？是时间窗没开，还是做法错了？把这个想明白，比问一百个用户”你想要什么”都有用。&lt;/p&gt;
&lt;p&gt;因为&lt;a href=&quot;/posts/2021/pm28/&quot;&gt;用户会说谎&lt;/a&gt;，而且自己意识不到。没有汽车的时候，人们只想要一匹更快的马；用户张口提的都是 Requirement 和 Demand，很少是 Need。调研还有霍桑效应——工人知道工厂在做实验，灯光调亮、调暗，效率都会提高。更有效的办法，是去问那些在用产品、而且用出了问题的人。&lt;/p&gt;
&lt;h2 id=&quot;供需关系决定一切&quot;&gt;供需关系决定一切&lt;/h2&gt;
&lt;p&gt;王慧文的原话是&lt;strong&gt;供需关系决定一切&lt;/strong&gt;。供需只有两种状态，供过于求或者供不应求，难的是判断自己处在哪一种——团队还很容易把它搞反，假装不好搞的那一边不重要。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm29/&quot;&gt;人人车和瓜子二手车&lt;/a&gt;就是一对例子：人人车把买车用户的体验做到极致，但二手车行业供不应求，缺的是车，不是体验；瓜子把力气花在了卖方。零售老板也一样，嘴上说供给重要，选址却每次亲自去——身体比嘴诚实。&lt;/p&gt;
&lt;p&gt;供需还分&lt;a href=&quot;/posts/2021/pm30/&quot;&gt;空间、时间和分层&lt;/a&gt;。空间：同样做婚恋网站，定位城市白领和定位农村市场，广告该拉哪一边可能完全相反。时间：打车一天之内就要翻好几次——早高峰供不应求，中午平峰，下午供过于求，晚上又翻回来。&lt;/p&gt;
&lt;p&gt;分层里有最反直觉的一条：&lt;strong&gt;高端的供需弹性大，低端的弹性小。&lt;/strong&gt; 高端客户有钱，买错了试错成本低，给他一个理由就愿意试。《创新者的窘境》的作者克里斯滕森当年预测，电动车会按低端颠覆的路子，从校车、老年代步车切入；特斯拉偏偏从高端杀进去，赢的是特斯拉。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm31/&quot;&gt;最后一篇&lt;/a&gt;里有全系列最好的实操案例。美团做团购时有个口号叫”狂拜访，狂上单”，拼命加商家；到了校园外卖，这套路径依赖行不通了，但道理讲完团队也改不过来。后来成都一个城市经理在一所学校里只上了 8 个商家，然后猛搞推广、发传单、做促销，还提前告诉商家明天单子会很多，多招几个人。订单集中在少数商家身上，商家立刻感受到需求有多旺，配送跟不上就马上补人；体验上去了，留存跟着上去；再加几个商家，再推一轮。商家数、订单量、用户体验、配送效率形成循环，业务就转起来了。&lt;/p&gt;
&lt;p&gt;关键就一句：认清这个阶段缺的是需求还是供给。搞反了，就搞砸了。&lt;/p&gt;
&lt;h2 id=&quot;放到今天的-ai需求和供需&quot;&gt;放到今天的 AI：需求和供需&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Need 和 Requirement：跑分是 Requirement，把事办完才是 Need。&lt;/strong&gt; 用户张口说的是”模型再聪明一点&quot;&quot;上下文再长一点”，这是 Requirement；真正的 Need 是”把这件事替我办完”。这两年竞争的重心从刷榜转向 Agent，就是因为大家发现：跑分高，不等于活干完了。基准测试也会”说谎”——榜单上分数漂亮，用起来不一定顺手。该去问的，还是那些天天在用、而且用出了问题的人。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;机会窗：为什么是现在？&lt;/strong&gt; 替人办事的助理、会写代码的机器、自己开的车，这些需求一直都在，没怎么变过；变的是可行性那团电荷——Transformer、GPU、海量数据、强化学习，一起攒够了，闪电才劈下来。每个 AI 创业者都该先回答课上那三个问题，尤其是最后一个：为什么是现在，而不是三年前或者三年后？&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;供需：这一轮最缺的是供给。&lt;/strong&gt; 这几年 AI 行业最典型的供不应求出在供给侧：GPU、电力、数据中心。所以钱先流向了英伟达和云厂商；各家产品限流、排队、按额度卖，都是供给不足的信号。做 AI 应用的人要问自己：我这个阶段缺的是用户，还是能力和算力？搞反了，就是 AI 版的人人车——体验做得很漂亮，模型能力却撑不住。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;分层：AI 又走了一遍特斯拉的路。&lt;/strong&gt; 按低端颠覆的理论，新技术应该先做便宜的；可 AI 订阅偏偏往高端走，ChatGPT Pro、Claude Max 这种一两百美元一个月的档位，卖得比很多人预想的好。原因和特斯拉一样：&lt;strong&gt;高端的供需弹性大&lt;/strong&gt;，重度用户试错成本低，只要能帮他省下几个小时，就愿意付钱。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;非市场因素：不常起作用，一起作用影响就很大。&lt;/strong&gt; 芯片出口管制、各国监管、数据合规，这些课上一笔带过的”非市场因素”，在 AI 里变成了主角。它们甚至改写了第一篇里的规模效应范围：本该是全球型的模型生意，被切成了中美两个几乎平行的市场。&lt;/p&gt;
&lt;h2 id=&quot;一个完整的例子云端个人-ai-助理值不值得做&quot;&gt;一个完整的例子：云端个人 AI 助理值不值得做&lt;/h2&gt;
&lt;p&gt;最后，用三篇盘下来的整套框架，完整分析一个正在发生的生意——&lt;a href=&quot;/posts/2026/grokbot%E5%92%8Cmeta-muse%E4%BA%91%E7%AB%AF%E4%B8%AA%E4%BA%BAai%E5%8A%A9%E7%90%86%E8%A6%81%E7%88%86%E4%BA%86/&quot;&gt;上一篇&lt;/a&gt;写的云端个人 AI 助理。xAI 给 Agent 一台永远在线的云电脑，Meta 把 Muse 做到了 App Store 第一，OpenAI 大概率也要下场。这门生意值不值得做？按顺序问一遍。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;市场体量：很大。&lt;/strong&gt; 以前只有高管请得起秘书和助理，现在每个人都可能有一个。这个市场的天花板要按”人的时间值多少钱”来估，不是按 App 的下载量估。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;规模效应：弱网络效应，强个人积累。&lt;/strong&gt; 你的助理好不好用，主要取决于它有多了解你——记忆、授权的账号、跑过的任务，这是单个用户的积累，不是网络效应。bot 市场和插件生态能带来一点网络效应，但不强。所以它更像 B 曲线，只是切换成本很高：一旦你把邮箱、日程、账号都交给了它，就很难再搬家。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;马太效应和集中度：终局是少数几家。&lt;/strong&gt; 做通用助理，要同时有模型、算力和用户入口，门槛极高。这是一个”剩两三家”的行业，终局大概率属于手里有入口的大公司。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;产业链：链主在两端。&lt;/strong&gt; 上游是模型和算力，下游是入口——手机系统、社交关系链、账号体系。独立的通用助理夹在中间，两头受挤。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;先发与后发：Siri 是先发者。&lt;/strong&gt; Siri 2011 年就上线了，Alexa 也红过一阵。它们的盲区在分类：把助理定义成”听懂语音指令”。这一代后发者重新分类，定义成”给 Agent 一台电脑，让它替你干活”——和 iPhone 把手机重新定义成互联网终端，是同一个动作。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;高频打低频：拼的是谁的入口更高频。&lt;/strong&gt; Meta 有社交，xAI 有 X，OpenAI 有 ChatGPT。个人助理本身是中低频的，必须挂在一个高频入口上，才能被用户想起来。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;需求与供需：需求不缺，缺的是供给。&lt;/strong&gt; 用户的 Need 是”把事办完”，不是”陪我聊天”。现在的瓶颈在供给侧：Agent 办事的可靠性，和让它一直在线的算力成本。所以各家都先卖高端订阅——高端弹性大，重度用户最愿意为”少干一点活”付钱。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;按这套框架推下来，我的判断是：&lt;strong&gt;这是个真需求、大市场，时机也到了；但通用助理是巨头的战场，终局剩不了几家。&lt;/strong&gt; 对普通创业者，机会不在正面做一个”全能助理”，而在链条上那些模型越强反而越值钱的位置：垂直场景的 bot、给助理供货的插件和数据、替助理把线下的事办完的服务。&lt;/p&gt;
&lt;p&gt;这就是我对开头那个问题的回答。五年前笔记里的案例，饿了么早已卖给了阿里，千团大战、二手车大战都成了旧闻；但”市场多大、终局几家、缺需求还是缺供给”这些追问，放到 AI 身上一个都没过期。唯一要改的，是互联网时代”边际成本为零”那条默认假设。&lt;/p&gt;
&lt;p&gt;讲课的人自己也回到过牌桌上。王慧文 2020 年底从美团退休，2023 年又出来创办光年之外做大模型，几个月后因为身体原因退出，公司并入了美团。结局不算圆满，但出手的姿势很像他自己讲的：相信一件事早晚会发生，就下场试一次。&lt;/p&gt;
&lt;p&gt;31 篇笔记，到这篇算是盘完了。博客里还有 25 篇亚马逊致股东信、一堆读书笔记和创业笔记，后面找时间也这样盘一遍。明天的文章明天见。&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;本系列：&lt;a href=&quot;/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%80-%E4%BB%80%E4%B9%88%E7%94%9F%E6%84%8F%E8%83%BD%E5%81%9A%E5%A4%A7/&quot;&gt;一：什么生意能做大&lt;/a&gt; · &lt;a href=&quot;/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%BA%8C-%E4%BB%80%E4%B9%88%E6%97%B6%E5%80%99%E8%BF%9B%E6%80%8E%E4%B9%88%E6%89%93/&quot;&gt;二：什么时候进，进去怎么打&lt;/a&gt; · &lt;strong&gt;三：一切的原点是需求&lt;/strong&gt;&lt;/p&gt;</content:encoded><category>产品课</category><category>产品课</category><category>王慧文</category><category>产品经理</category></item><item><title>重读产品课笔记（二）：什么时候进，进去怎么打</title><link>https://pxiaoer.blog/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%BA%8C-%E4%BB%80%E4%B9%88%E6%97%B6%E5%80%99%E8%BF%9B%E6%80%8E%E4%B9%88%E6%89%93/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%BA%8C-%E4%BB%80%E4%B9%88%E6%97%B6%E5%80%99%E8%BF%9B%E6%80%8E%E4%B9%88%E6%89%93/</guid><description>重读王慧文产品课 31 篇笔记的第二篇：先发与后发、增量还是存量、高频打低频、入场时机、PMF、4P、分类经营——再拿它们看今天的 AI：为什么 Copilot 先发、Cursor 后发，为什么编程是 AI 的&quot;卖书&quot;，为什么 AI 很难把价格压到 0。</description><pubDate>Fri, 25 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;100 天 100 篇，第 4 篇。&lt;/p&gt;
&lt;p&gt;接着&lt;a href=&quot;/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%80-%E4%BB%80%E4%B9%88%E7%94%9F%E6%84%8F%E8%83%BD%E5%81%9A%E5%A4%A7/&quot;&gt;昨天&lt;/a&gt;那篇。31 篇产品课笔记摞成四层，昨天盘了第一层「什么生意能做大」，今天盘中间两层：什么时候进场、怎么进，以及进去之后怎么打。最后照例放到今天的 AI 里，看看这些打法还灵不灵。&lt;/p&gt;
&lt;h2 id=&quot;全系列最好看的故事先发与后发&quot;&gt;全系列最好看的故事：先发与后发&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm10/&quot;&gt;后发优势&lt;/a&gt;这篇，是 31 篇里故事最好看的一篇。&lt;/p&gt;
&lt;p&gt;饿了么起步的方式极其聪明。几个创始人去学校门口数外卖员，外卖员进出多，说明这所学校外卖基础好。然后给商家做了个订餐管理软件——以前学生打电话点餐，商家手抄电话和地址，一忙就记不清哪单送了哪单没送；现在订单在网站上，送完勾一下就行。&lt;/p&gt;
&lt;p&gt;商家用得太顺手，会主动把手机铃声设成”点外卖请用饿了么”，甚至把记满顾客电话的账单本交给饿了么，让它挨个发短信拉新。不补贴用户，不用说服谁，不建配送团队，开了十几座城市基本不亏钱，一年增长 200% 左右。&lt;/p&gt;
&lt;p&gt;但也正因为这套打法太省钱，他们只开”数得出外卖员”的学校——开了十几座城市，却没开大学生最多的武汉。美团后发进场，思路完全不同：用大学生数量去算市场体量，算出这是个大生意，起步就开 20 座城，两个月后开到 60 座。人不会做不要紧，先把人扔进去，让用户看到产品。&lt;/p&gt;
&lt;p&gt;这就是先发者和后发者的根本差别：&lt;strong&gt;创新者通常有思维盲区，后发者按正常的商业逻辑算账&lt;/strong&gt;。后发还有另外两重优势：不用去说服市场——乔布斯说电脑是”人类思考的自行车”的时候，没几个人听得懂；以及确定这件事一定能实现——第一个造原子弹和第二个造，难度完全不同。&lt;/p&gt;
&lt;p&gt;美团当时也纠结了很久，最后进场的理由只有一句：&lt;strong&gt;这是个大生意，这个市场不会只剩下一家。&lt;/strong&gt; 所以别被先发优势的光环吓退，行业够大、终局不止一家，就有后发的位置。&lt;/p&gt;
&lt;h2 id=&quot;进场前的三个判断&quot;&gt;进场前的三个判断&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;/posts/2021/pm11/&quot;&gt;增量还是存量&lt;/a&gt;：渗透率过了 50%，格局就很难变；存量市场的获客成本是增量的十倍起，后发者进存量，约等于全世界与你为敌。存量也不是完全没机会——可口可乐一度占了九成以上的份额，百事对着”可乐就是可口可乐”的心智，只喊一句”年轻人应该喝百事”。这是&lt;a href=&quot;/posts/2021/pm14/&quot;&gt;迈克尔·波特三战略&lt;/a&gt;里的差异化。但最好做的还是增量，是新的价值网：iPhone 赢诺基亚，不是因为它是更好的手机，而是它把手机定义成了互联网终端。&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/posts/2021/pm-12/&quot;&gt;高频打低频&lt;/a&gt;：高频应用天然能替换低频应用，换手机的时候先装回来的都是高频的。创业公司要活得久，得有三级火箭——头部流量、沉淀商业场景、完成商业闭环。罗辑思维是免费脱口秀、得到 App、付费课程；小米是手机、零售场景、高利润产品。第一级火箭一定是高频的。&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/posts/2021/pm-13/&quot;&gt;入场时机&lt;/a&gt;：天时大于地利，地利大于人和。判断不了，就记两句：相信一件事早晚会发生，就每三年试一次；只要公司没倒，早入场就在积累正确的认知。&lt;strong&gt;所有伟大的需求，都一定被前人用错误的方法、或在错误的时间试过很多次。&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;进去之后怎么打&quot;&gt;进去之后怎么打&lt;/h2&gt;
&lt;p&gt;框架在这个阶段最密集。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm16/&quot;&gt;PMF&lt;/a&gt; 讲了三种死法：没找到 PMF，钱先烧光了；还没找到，团队先散了；最冤的是找到了，却没发力猛搞。切入点要选最锐利的那个——&lt;a href=&quot;/posts/2021/pm19/&quot;&gt;亚马逊最先卖书&lt;/a&gt;，是因为书 SKU 多、标准化、不怕压不怕摔不过期，而早期网民恰好都爱买书。但切入点不是终点站。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm17/&quot;&gt;创新的扩散&lt;/a&gt;：2.5% 的创新者，13.5% 的早期采用者，然后才轮到大众。早期产品不用完美，简单粗暴有效就行；关键是找对人。搜狗输入法先做给输入法论坛的用户，小米先做给 MIUI 论坛的用户——社区就是早期采用者的聚集地。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm18/&quot;&gt;STP&lt;/a&gt; 三部曲：细分、目标、定位。最值钱的一句在第一步：&lt;strong&gt;细分市场就是选对坐标系；如果你在做一个很艰难的决策，说明你分析得还不够好。&lt;/strong&gt; 选目标市场时要分清&lt;a href=&quot;/posts/2021/pm19/&quot;&gt;切入点和目标市场&lt;/a&gt;：校内网的切入点是校园，目标市场是所有人。切入点要选长期看对自己最有利的那个。&lt;/p&gt;
&lt;p&gt;4P 到了互联网时代，&lt;a href=&quot;/posts/2021/pm22/&quot;&gt;变成了一个动作&lt;/a&gt;：&lt;strong&gt;把一个 P 挤压为 0，在另一个 P 上挣钱。&lt;/strong&gt; 360 把杀毒变成免费，产品本身成了渠道，去挣渠道的钱；淘宝取消上架费，把渠道和推广合在一起收推广费；Costco 把商品价格压到最低，去挣会员费。&lt;/p&gt;
&lt;p&gt;最后两篇最有美团味。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm23/&quot;&gt;分层运营&lt;/a&gt;：团队缺用户，就去抓头部商家；缺商家数量，就去抓尾部，腰部永远被忽略。顺带解释了为什么只做头部客户的 To B 软件公司很难赚钱——头部议价能力强，定制化是无底洞；而中国恰好头部很大、尾部很多、腰部太少，产品化很难找到客户群。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm24/&quot;&gt;分类经营&lt;/a&gt;里有整个系列最猛的一个观点。张小龙说设计即分类，王慧文把它推到了创业上：&lt;strong&gt;你怎么分类，决定了你创业的起点和基因。&lt;/strong&gt; 同样做电商，淘宝看到的是品类和流量，拼多多看到的是货找人。两家不在同一个平面上争地盘，这叫错位竞争。&lt;/p&gt;
&lt;h2 id=&quot;放到今天的-ai谁先进场谁打得赢&quot;&gt;放到今天的 AI：谁先进场，谁打得赢&lt;/h2&gt;
&lt;p&gt;饿了么的故事里，其实没有谁犯了低级错误：饿了么的打法极其高效，美团也只是正常算账。先发者输给后发者，往往不是因为做错了什么，而是做对的那件事限制了自己的视野。这句话放到今天的 AI 里，几乎每天都在应验。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;后发优势：Copilot 和 Cursor。&lt;/strong&gt; GitHub Copilot 2021 年就上线了，是 AI 编程的先发者，背后站着微软和 OpenAI，一点都不缺资源。但它的起点是 VS Code 里的一个补全插件，思路也被”插件”框住了。后来的 Cursor 直接把整个编辑器重做了一遍；再后来，Claude Code、Codex 干脆离开编辑器，让 Agent 在终端里自己干活。先发者没做错什么，只是做对的那件事限制了视野——和饿了么一模一样。再往前看，ChatGPT 本身也是后发者，聊天机器人几十年前就有了。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;增量还是存量：AI 搜索是存量战，AI 编程是增量战。&lt;/strong&gt; 搜索是被 Google 占了九成的存量市场，Perplexity 这样的后发者只能靠差异化切一小块，用户的习惯和广告主都站在 Google 那边。而”让 AI 写代码、替人干活”是一张新的价值网，没有旧格局要打破，所以长得最快。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;高频打低频：所有人都在抢入口。&lt;/strong&gt; 聊天助手是这一代最高频的入口，所以 ChatGPT 往里接各种 App、做购物下单，Meta 把 Muse 挂在社交关系链上，xAI 把 Grok 挂在 X 上。三级火箭也清清楚楚：免费聊天是头部流量，工作流和 Agent 是沉淀下来的场景，订阅和交易完成商业闭环。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;入场时机：Agent 早就被试过很多次。&lt;/strong&gt; 2023 年 AutoGPT 火过一阵，很快就凉了——需求是真的，可行性还没攒够。等到模型能稳定地写代码、调工具，2025 年编程 Agent 先爆发，今年又轮到云端个人助理。Siri、Alexa 这些上一代助理，就是”在错误的时间试过”的那一批。&lt;strong&gt;所有伟大的需求，都被前人试过很多次&lt;/strong&gt;，这句话在 AI 身上再准不过。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PMF 和切入点：编程就是 AI 的”卖书”。&lt;/strong&gt; 亚马逊选书，是因为标准化、不怕摔、早期网民爱买书。AI 选编程几乎一一对应：代码写得对不对，能用测试来验证；程序员本身就是创新者和早期采用者，愿意折腾，也愿意付钱。先在最锐利的切入点做透，再往其他知识工作扩散——这是教科书式的创新扩散。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4P：AI 很难把一个 P 压到 0。&lt;/strong&gt; 这是我觉得这套框架最需要改的地方。互联网能把价格压到 0，是因为复制成本几乎为零，多一个用户几乎不花钱；AI 每回答一次都在烧算力，边际成本不是零。所以各家的免费档都有额度，越用越贵的反而是重度用户。“免费拉用户，别处挣钱”这招，在 AI 时代要先算清楚每个免费用户烧掉多少 token。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;分类经营：你把 AI 当成什么，就做出什么。&lt;/strong&gt; 把 AI 看成”更聪明的搜索框”，做出来的是聊天产品；看成”员工”，做出来的是 Agent；看成”一台永远在线的云电脑”，做出来的就是 Grok Bot。分类不同，就不在同一个平面上竞争——这是今天的 AI 创业者最该想清楚的第一件事。&lt;/p&gt;
&lt;p&gt;打法盘完。明天最后一篇：一切的原点——需求与供需。最后我会用整套框架，从头到尾完整分析一个今天的 AI 生意。&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;本系列：&lt;a href=&quot;/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%80-%E4%BB%80%E4%B9%88%E7%94%9F%E6%84%8F%E8%83%BD%E5%81%9A%E5%A4%A7/&quot;&gt;一：什么生意能做大&lt;/a&gt; · &lt;strong&gt;二：什么时候进，进去怎么打&lt;/strong&gt; · 三：一切的原点是需求（明天见）&lt;/p&gt;</content:encoded><category>产品课</category><category>产品课</category><category>王慧文</category><category>产品经理</category></item><item><title>重读产品课笔记（一）：什么生意能做大</title><link>https://pxiaoer.blog/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%80-%E4%BB%80%E4%B9%88%E7%94%9F%E6%84%8F%E8%83%BD%E5%81%9A%E5%A4%A7/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2026/%E9%87%8D%E8%AF%BB%E4%BA%A7%E5%93%81%E8%AF%BE%E7%AC%94%E8%AE%B0%E4%B8%80-%E4%BB%80%E4%B9%88%E7%94%9F%E6%84%8F%E8%83%BD%E5%81%9A%E5%A4%A7/</guid><description>五年前我把王慧文的清华产品课整理成 31 篇笔记，今天分三篇重读，只想回答一个问题：AI 时代这套框架还有没有用？第一篇：什么生意能做大——市场体量、规模效应、马太效应、市场集中度、产业链，以及拿它们来看今天的大模型生意。</description><pubDate>Thu, 24 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;100 天 100 篇，第 3 篇。&lt;/p&gt;
&lt;p&gt;前两篇都在往前赶，今天往回看。这个博客里躺着 400 多篇文章，我想挑一个写得最成体系的分类认真盘一遍——「产品课」。2020 年底我给王慧文在清华讲的《互联网产品管理》开了个&lt;a href=&quot;/posts/2020/internet-pm/&quot;&gt;目录&lt;/a&gt;，2021 年春夏陆续写完 31 篇笔记，从&lt;a href=&quot;/posts/2021/pm01/&quot;&gt;那些年曾经成功的失败产品&lt;/a&gt;一直写到&lt;a href=&quot;/posts/2021/pm31/&quot;&gt;供需关系的非市场因素&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;五年后重读，案例旧了不少——团购、外卖、打车、二手车，都是上一个时代的仗。现在大家都在聊 AI，我重读时脑子里只转着一个问题：&lt;strong&gt;这套讲团购外卖的框架，放到今天还有没有用？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;内容有点多，拆成三篇。每篇前半部分盘框架，最后一部分拿它来分析今天的 AI。今天先盘第一层：什么生意能做大。&lt;/p&gt;
&lt;h2 id=&quot;这门课教的不是产品是生意&quot;&gt;这门课教的不是产品，是生意&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;/posts/2021/pm01/&quot;&gt;第一篇笔记&lt;/a&gt;里有个数字：一个领域里，成功和失败的产品大概是 1:30。更有意思的是，几乎每个大行业最后赢的都不是第一家——Google 不是第一个做搜索的，Tesla 不是第一个做电动车的，微信前面站着 Kik 和米聊。当技术不再是瓶颈，拼的就是资源的组合。&lt;/p&gt;
&lt;p&gt;所以这 31 篇笔记，除了开头两篇聊&lt;a href=&quot;/posts/2021/pm02/&quot;&gt;产品经理&lt;/a&gt;这个职业，基本不讲画原型、写 PRD。它反复在问四件事：&lt;strong&gt;什么生意能做大，什么时候进场，进去之后怎么打，以及一切的原点——需求&lt;/strong&gt;。31 篇正好摞成这四层。&lt;/p&gt;
&lt;h2 id=&quot;市场体量判断错了后面全错&quot;&gt;市场体量：判断错了，后面全错&lt;/h2&gt;
&lt;p&gt;第一个判断是&lt;a href=&quot;/posts/2021/pm04/&quot;&gt;市场体量&lt;/a&gt;。王慧文给战略下的定义很干：&lt;strong&gt;战略是不同时空里 ROI 最高的策略&lt;/strong&gt;。而 ROI 的分母怎么放，先看体量。&lt;/p&gt;
&lt;p&gt;高估了，就是共享单车，往一个不够大的市场砸了太多钱；低估了，就是格瓦拉——电影票选座做得非常好，却觉得这个市场不够大，转身去做羽毛球馆预订，把猫眼级别的生意让了出去。反过来，美团看到饿了么不亏钱还一年增长 200%，判断外卖能到一天 1000 万单，才有了后面的进场。&lt;/p&gt;
&lt;p&gt;怎么判断？两条路：一是拿现有行业数据和增速去拟合，样本越多越准，边做边修正；二是从人的根本需求往回推——家庭越来越小，自己做饭迟早被社会分工替代，看看日本便利店有多大，就能估出外卖的天花板。&lt;/p&gt;
&lt;h2 id=&quot;规模效应商业世界的万有引力&quot;&gt;规模效应：商业世界的万有引力&lt;/h2&gt;
&lt;p&gt;体量说的是天花板，&lt;a href=&quot;/posts/2021/pm05/&quot;&gt;规模效应&lt;/a&gt;说的是你能不能长到天花板。王慧文管它叫商业世界的万有引力，画了三条曲线：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A 曲线，指数型&lt;/strong&gt;：微信这种网络效应，先过临界规模的那家会迅速甩开后面所有人，赢家通吃。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;B 曲线，线性型&lt;/strong&gt;：淘宝多一个用户就多一点价值，但也只是一点。所以它做到那么大，还是拦不住京东和拼多多进来。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C 曲线，对数型&lt;/strong&gt;：外卖、打车这类双边网络，还带着同边负效应——你打走的车，旁边的人就打不到了。规模上去之后，优势会变缓。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;规模效应还分&lt;a href=&quot;/posts/2021/pm06/&quot;&gt;范围&lt;/a&gt;。微信是全球型，淘宝是全国型，打车是城市型，外卖是蜂窝型——你在清华占有率 90%，和北大一点关系都没有，所以外卖从头到尾都是巷战。&lt;/p&gt;
&lt;p&gt;同一种效应，参数也能天差地别。MySpace 和 Facebook 都有网络效应，前者做陌生人社交，后者做真实好友，一个学校一个学校开过去，每开一所，那所学校里 Facebook 的活跃度就比 MySpace 高。大部分人的陌生人社交都会失败，不管用什么工具。&lt;/p&gt;
&lt;p&gt;这一篇还有一句反常识的话，值得抄下来：&lt;strong&gt;管理是反规模效应&lt;/strong&gt;。公司能做大，不是因为管理做得好，而是业务的强规模效应抵消了管理的副作用。所以只要能把事干了，人越少越好。&lt;/p&gt;
&lt;h2 id=&quot;马太效应优势会自己滚起来&quot;&gt;马太效应：优势会自己滚起来&lt;/h2&gt;
&lt;p&gt;规模效应讲的是业务本身，&lt;a href=&quot;/posts/2021/pm07/&quot;&gt;马太效应&lt;/a&gt;讲的是人心：大多数人判断不了一件事，只能跟着看起来正确的人走，于是领先者越来越领先。王慧文说它是商业世界的进化论，对早期创业者尤其要命——融资、招人、媒体都在往领先者身上聚。&lt;/p&gt;
&lt;p&gt;判断谁在领先，信号不一定好看。今日资本 2008 年看京东，看的是两件事：销售额快速增长，同时网上很多人在骂。&lt;strong&gt;有人骂还快速增长，说明需求旺盛，边骂边用。&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;市场集中度终局剩几家&quot;&gt;市场集中度：终局剩几家&lt;/h2&gt;
&lt;p&gt;体量再大，&lt;a href=&quot;/posts/2021/pm08/&quot;&gt;集中度&lt;/a&gt;不够也出不了大公司。餐饮就是典型的大行业小企业，投了也白投。&lt;/p&gt;
&lt;p&gt;集中度可以看 CR 值（前几家占多少份额），更实用的问法是：这个行业最后剩几家？1 家、2 到 3 家，还是无数家。这个判断直接决定打法——&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;剩很多家的行业，老板们关系都不错，比的是差异化；&lt;/li&gt;
&lt;li&gt;剩 2 到 3 家的行业，竞争最惨烈，要尽快成为领先者，但又不能过度投入。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;千团大战时美团的原则就是这么来的：终局只剩两三家，投资人只投前三，所以保住前三，而且要做前三里 ROI 最高的，不一定是体量最大的。&lt;/p&gt;
&lt;h2 id=&quot;产业链钱最后落在哪一环&quot;&gt;产业链：钱最后落在哪一环&lt;/h2&gt;
&lt;p&gt;最后一环是&lt;a href=&quot;/posts/2021/pm09/&quot;&gt;产业链&lt;/a&gt;。行业很大，但每一环不一样，活得最好的是链主——电脑行业的链主是微软。&lt;/p&gt;
&lt;p&gt;链主再往前一步，就是生态。Amazon 从网上卖书，到做书评，到做 Kindle，最后让作者直接用 Kindle 格式写作、写完再出纸质书，把整个出版流程倒了过来。课上的提醒也很清醒：有的行业没有生态，硬搞就掉坑里；搞生态的前提，是真能让全行业效率变高。&lt;/p&gt;
&lt;h2 id=&quot;放到今天的-ai这门生意能有多大&quot;&gt;放到今天的 AI：这门生意能有多大&lt;/h2&gt;
&lt;p&gt;把这五篇串起来，其实是一串追问：市场有多大？会不会越大越强？优势会不会自己滚起来？终局剩几家？钱最后落在链条的哪一环？五年前记笔记，我记的是一个个结论和案例；现在重读，更值钱的是这个追问的顺序。&lt;/p&gt;
&lt;p&gt;拿这串追问去问今天的 AI，会发现很多吵得很热闹的讨论，其实都能在这五篇里找到位置。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;市场体量：先分清你在估哪个市场。&lt;/strong&gt; “AI 市场有多大”是个没法回答的问题，得拆开估。大模型卖的其实不是软件，是劳动力——编程、客服、写作、分析，这些知识工作本来是按人头发工资的，所以天花板应该按工资总额估，而不是按企业的软件预算估。AI 编程是第一个被验证的大市场：程序员工资高，产出能验证，Cursor、Claude Code、Codex 这些工具的收入都长得飞快。反过来，大量”给老产品加一个 AI 按钮”的功能，是高估了体量，最后就是 AI 版的共享单车。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;规模效应：模型层更像 B 曲线，不是 A 曲线。&lt;/strong&gt; 训练是巨额的固定投入，这是成本型的规模效应；但聊天产品之间几乎没有网络效应——你用 ChatGPT 不会因为朋友也在用而更好用，今天换 Claude、明天换 Gemini，切换成本接近零。所以这几年领先者一直在被追上，DeepSeek 甚至用小得多的成本做出了第一梯队的模型。各家拼命做记忆、做个人数据、做插件和 bot 市场，本质上都是想把这条直线往上掰。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;管理是反规模效应：AI 把这句话推到了极致。&lt;/strong&gt; 几十个人的团队做到上亿美元收入，在 AI 公司里已经不稀奇。Agent 能干的活越多，“只要能把事干了，人越少越好”就越不像一句口号。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;马太效应：钱、人、算力一起往头部走。&lt;/strong&gt; 融资一轮比一轮大，顶级研究员的身价被抬到上亿美元。在一个大多数人判断不了技术路线的行业里，大家只能跟着看起来领先的人走，这正是马太效应最强的土壤。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;集中度：模型层剩几家，应用层剩无数家。&lt;/strong&gt; 国内 2023 年的”百模大战”，打到今天还留在牌桌上的基础模型公司屈指可数；全球的前沿模型也就那么几家。按课上的逻辑，模型层是”终局剩两三家”的惨烈型竞争，要么尽快进前几名，要么尽早换打法；应用层则会是大行业小企业，拼的是差异化。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;产业链：今天的链主是谁？&lt;/strong&gt; 这一轮最先赚到大钱的是最上游的算力，英伟达；另一端是握着用户入口的公司。夹在中间的”套壳”应用最难受——上游模型一升级，就可能顺手把你的功能做掉。所以做 AI 应用，先想清楚一件事：你在链条上的位置，是模型越强你越值钱，还是模型越强你越多余？&lt;/p&gt;
&lt;p&gt;回到开头的问题：这一层框架不但没过期，反而更好用了。AI 越吵，越需要一个固定的追问顺序。&lt;/p&gt;
&lt;p&gt;明天第二篇：什么时候进场、怎么进、进去之后怎么打——里面有全系列最好看的故事，饿了么和美团。&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;本系列：&lt;strong&gt;一：什么生意能做大&lt;/strong&gt; · 二：什么时候进，进去怎么打（明天见） · 三：一切的原点是需求（后天见）&lt;/p&gt;</content:encoded><category>产品课</category><category>产品课</category><category>王慧文</category><category>产品经理</category></item><item><title>Grok Bot 和 Meta Muse：云端个人AI助理要爆了？</title><link>https://pxiaoer.blog/posts/2026/grokbot%E5%92%8Cmeta-muse%E4%BA%91%E7%AB%AF%E4%B8%AA%E4%BA%BAai%E5%8A%A9%E7%90%86%E8%A6%81%E7%88%86%E4%BA%86/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2026/grokbot%E5%92%8Cmeta-muse%E4%BA%91%E7%AB%AF%E4%B8%AA%E4%BA%BAai%E5%8A%A9%E7%90%86%E8%A6%81%E7%88%86%E4%BA%86/</guid><description>xAI 给 Agent 一台长期在线的云电脑，Meta 把个人助理做到 App Store 第一，OpenAI 大概率也同场押注。为什么这种云端&quot;AI 员工&quot;形态突然就火了？</description><pubDate>Wed, 23 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;100 天 100 篇，第 2 篇。&lt;/p&gt;
&lt;p&gt;今天聊一个正在发生的事：个人 AI 助理，突然全来了。&lt;/p&gt;
&lt;h2 id=&quot;先说-grok-bot给-agent-一台电脑&quot;&gt;先说 Grok Bot：给 Agent 一台电脑&lt;/h2&gt;
&lt;p&gt;8 月 xAI 推出了 Grok Bot，一句话概括：给 Agent 一台长期在线的电脑，让它进入真实的软件、网站和工作流程，然后像员工一样持续完成任务。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/posts/grokbot-agent-panel.png&quot; alt=&quot;Agent 任务面板：欢迎卡片、任务列表和 Describe a task 输入框&quot;&gt;&lt;/p&gt;
&lt;p&gt;开通门槛不高：Cursor、X 或者 Grok 的会员都有权限，每个等级对应不同额度，其中 Cursor 20 刀是最便宜的使用方式。&lt;/p&gt;
&lt;p&gt;界面做得很”社交”：可以新建一个 bot，把各种 bot 拉进群里一起用，还有一个市场——里面既有调你数据的插件，也有别人预设好的 bot，直接拿来就能用。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/posts/grokbot-marketplace.png&quot; alt=&quot;市场：插件和 Bot 两个货架，按场景分类&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/posts/grokbot-new-bot.png&quot; alt=&quot;新建 Bot：cli-bot、concept-generator、reddit-poster&quot;&gt;&lt;/p&gt;
&lt;p&gt;案例：我自己 200 刀的 Codex 账户被封，新建了一个 bot 来申诉。&lt;/p&gt;
&lt;p&gt;但真正的重点是&lt;strong&gt;主机&lt;/strong&gt;：每个账号有一台属于你的虚拟机，16G 内存，带浏览器、文件系统和终端。这台电脑是你的，你可以直接上去操作，跑的东西都放在上面，随时可以拿回来。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/posts/grokbot-agents-dashboard.png&quot; alt=&quot;Agent 任务仪表盘：running、completed、failed 一目了然&quot;&gt;&lt;/p&gt;
&lt;p&gt;你把任务交给 bot 之后，自己的电脑关掉也没关系，它的任务和定时流程照样在云端继续跑。&lt;/p&gt;
&lt;p&gt;还有个功能我觉得被低估了：&lt;strong&gt;Teach a task&lt;/strong&gt;。你可以直接录屏，演示一遍怎么做某件事，它就学会了，以后这个流程交给它。教一次，终身代办。&lt;/p&gt;
&lt;p&gt;和 openclaw 比，Grok Bot 其实更进一步：openclaw 是给你的 Agent 加能力，Grok Bot 是直接替换掉”你自己的电脑”这个概念——随时随地把活干了。&lt;/p&gt;
&lt;h2 id=&quot;meta-muse大公司下场了&quot;&gt;Meta Muse：大公司下场了&lt;/h2&gt;
&lt;p&gt;9 月 8 日，Meta 发布了 Muse，号称”世界第一个个人 AI 助理”。&lt;/p&gt;
&lt;p&gt;路数和 Grok Bot 是一个方向，但打法更消费级：主动帮你达成目标、盯价格、管提醒、订餐厅、买电影票、生成文档和图片，打通了 Facebook、Instagram 和一批第三方应用。免费档起步，订阅 20 刀或 100 刀一个月，按用量分。&lt;/p&gt;
&lt;p&gt;上线没多久就冲到了 App Store 第一。Meta 用它最擅长的方式入局：免费 + 社交关系链 + 亿级装机量。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/posts/meta-muse-desktop.png&quot; alt=&quot;Muse desktop Mac app&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;openai-也要参与进来&quot;&gt;OpenAI 也要参与进来&lt;/h2&gt;
&lt;p&gt;OpenAI DevDay 就在这几天。目前放出来的消息都指向同一个方向：agent 环境、skills、插件体系，外加面向企业的 managed agents。各家媒体的判断基本一致——消费级的 ChatGPT 个人助理，大概率同场发布。&lt;/p&gt;
&lt;p&gt;有人说叫 Codex bot，我觉得这名字不太可能，Codex 名字已经没了，现在都叫 ChatGPT，但是 OpenAI 大概率发一个差不多的。&lt;/p&gt;
&lt;h2 id=&quot;为什么这种个人助理会火&quot;&gt;为什么这种个人助理会火&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;技术拐点&lt;/strong&gt;：模型能力终于够了。长任务的可靠性、computer use 的成熟度，都跨过了”能看”到”能用”的线。以前让 AI 操作浏览器是个 demo，现在是个产品。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;形态拐点&lt;/strong&gt;：从聊天框到一台电脑。聊天是问答，你问它答，答完就散；电脑是雇佣，你给目标，它自己找活干。这里面”长期在线”是关键——你关机它还在跑，“睡觉的时候活干完了”这件事一旦体验过，就回不去了。这是它和过去所有 assistant 的本质区别。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;成本拐点&lt;/strong&gt;：一台 16G 云电脑加模型调用，能打包成 20 刀一个月的订阅。AI 员工的月薪，比人类实习生的一顿饭钱还便宜。价格到了这个位置，需求自然被点燃。&lt;/p&gt;
&lt;p&gt;再往后看一步：当一个人拥有多个长期工作的 AI 员工，管理这些员工就会成为新的产品需求，agent 编排的需求就出现了。到那时候，真正的贾维斯才会来。&lt;/p&gt;
&lt;p&gt;现在还是这场变革的很早期——就像 chatbot，人人都用，但真正的赢家还没入场。&lt;/p&gt;
&lt;p&gt;关注我，明天继续。&lt;/p&gt;</content:encoded><category>AI Research</category><category>AI Agent</category><category>Grok</category><category>Meta</category><category>OpenAI</category></item><item><title>和 AI 一起，把自己的博客重造了一遍</title><link>https://pxiaoer.blog/posts/2026/%E5%92%8Cai%E4%B8%80%E8%B5%B7%E6%8A%8A%E8%87%AA%E5%B7%B1%E7%9A%84%E5%8D%9A%E5%AE%A2%E9%87%8D%E9%80%A0%E4%BA%86%E4%B8%80%E9%81%8D/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2026/%E5%92%8Cai%E4%B8%80%E8%B5%B7%E6%8A%8A%E8%87%AA%E5%B7%B1%E7%9A%84%E5%8D%9A%E5%AE%A2%E9%87%8D%E9%80%A0%E4%BA%86%E4%B8%80%E9%81%8D/</guid><description>十年、431 篇文章、三次搬家：从 WordPress 到公众号，再到这个和 AI 一起重建的 pxiaoer.blog。以及一个新计划——2026 年倒计时 100 天，每天写一篇，写满 100 篇送走这一年。</description><pubDate>Tue, 22 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;这个站上线有一阵子了，但一直没正经介绍过它。今天补上：它从哪来，怎么做的，里面都装了什么。&lt;/p&gt;
&lt;h2 id=&quot;从-431-篇文章说起&quot;&gt;从 431 篇文章说起&lt;/h2&gt;
&lt;p&gt;pxiaoer.blog 现在有 431 篇文章，最早的一篇是 2017 年 1 月 1 日的 LeetCode 题解（Two Sum，用 Rust 写的），最新的一篇是前几天我三十七岁生日写的随笔。中间隔着十年。&lt;/p&gt;
&lt;p&gt;这十年里，这些文字散落在三个地方：&lt;/p&gt;
&lt;p&gt;最早的几年写在 WordPress 上，两百多篇。技术分析、CTF writeup、LeetCode 刷题、读书笔记，那会儿写东西很勤，有时候一周好几篇。&lt;/p&gt;
&lt;p&gt;后来重心搬到了微信公众号「P小二」。公众号适合中文读者，但它有个老问题：内容锁在微信生态里，网页版基本没法看，代码排版更是重灾区。十年下来，公众号这边又积累了两百多篇。&lt;/p&gt;
&lt;p&gt;于是有了现在这个站：把两个地方的内容全部搬出来，合到一起，用自己的域名，用自己的方式排版。老读者可以把它当成一个完整的档案库——从 2017 年刷 LeetCode 的我，到 2026 年研究 DeepSeek 开源周的我，都在这里。&lt;/p&gt;
&lt;h2 id=&quot;这个站是怎么做的&quot;&gt;这个站是怎么做的&lt;/h2&gt;
&lt;p&gt;讲讲技术。一来很多读者自己也在写博客，二来这个站本身的搭建过程，其实就是我平时说的”和 AI 一起干活”的一个完整案例。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;整体架构&lt;/strong&gt;：站是静态的，用 Astro 生成，托管在 Cloudflare 上。431 篇文章构建出 500 多个页面，全站没有服务器、没有数据库，打开速度快，也不怕流量。深色浅色主题、目录导航、阅读时长、全文搜索、RSS 订阅，该有的都有。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;图片&lt;/strong&gt;：全部存在 Cloudflare R2 对象存储上，走 img.pxiaoer.blog 这个子域名。WordPress 和公众号的图片一共九百多张，全部迁了出来，不依赖任何原平台。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;写作后台&lt;/strong&gt;：站上有个后台，基于 Sveltia CMS。我在任何设备打开浏览器就能写文章、传图、发布，内容直接提交到 GitHub 仓库，然后构建部署。图片从后台上传时会直传 R2，不进仓库。这套流程搭好之后，写东西的摩擦基本为零。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;AI 干了什么&lt;/strong&gt;：说实话，是大部分。从 WordPress 导出数据的迁移脚本、公众号文章的抓取和导入管线、整套排版和 SEO、到这次重迁中修不完的细节——最近的一次大修是把历史文章里几百处坏掉的代码块和 Markdown 格式全部修复，涉及三百多篇文章。这些全是和 AI 结对完成的，我的角色是决定要什么、验收什么。如果你想看 AI Coding 到底能干多少活，这个站就是一个正在进行中的答案。&lt;/p&gt;
&lt;h2 id=&quot;里面都有什么&quot;&gt;里面都有什么&lt;/h2&gt;
&lt;p&gt;按主题串一下，方便你找感兴趣的部分：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;AI 系列&lt;/strong&gt;（AI Research、AIGC、模型思维）：DeepSeek 开源周每天一篇的深度分析、大模型相关的论文和产品思考、AIGC 周刊，还有最近的 AI Coding 实践。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;安全系列&lt;/strong&gt;（AIPwn、API安全、hacker101-ctf、pentesterlab）：这是我写得最久的方向。API 安全测试的系列 tips、Hacker101 CTF 的逐题 writeup、机器学习安全的攻击模型分析，以及对抗样本、文本对抗攻击这些 AI 安全的早期文章。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;系统编程&lt;/strong&gt;（Rust、DPU、leetcode-rust）：Rust 每日一题、用 Rust 写安全工具、DPU 网络开发 SDK（DPDK）的长系列，还有游戏 AI 的方法论系列。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;产品与创业&lt;/strong&gt;（产品课、创业笔记、7 Day Startup、亚马逊致股东信）：产品方法论笔记、创业复盘、贝佐斯二十多年致股东信的完整精读。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;读书与随笔&lt;/strong&gt;（BookFlow、读书笔记、精神家园）：纳瓦尔宝典、原则、时间的秩序这些书的笔记，还有一些完全不像技术博客的东西——做空瑞幸亏钱的复盘、零分作文、生日随笔。&lt;/p&gt;
&lt;p&gt;十年写下来，分类越攒越多，但主线其实没变过：对一个东西感兴趣，就把它拆开看明白，然后写下来。&lt;/p&gt;
&lt;h2 id=&quot;过来玩&quot;&gt;过来玩&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;全部文章：&lt;a href=&quot;https://pxiaoer.blog/posts/&quot;&gt;pxiaoer.blog/posts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;订阅 RSS：&lt;a href=&quot;https://pxiaoer.blog/rss.xml&quot;&gt;pxiaoer.blog/rss.xml&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;公众号「P小二」照常更新，两边内容最终会汇合到这里&lt;/li&gt;
&lt;li&gt;找我：X &lt;a href=&quot;https://x.com/pxiaoer&quot;&gt;@pxiaoer&lt;/a&gt;、即刻「P小二」&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;倒计时-100-天100-篇&quot;&gt;倒计时 100 天，100 篇&lt;/h2&gt;
&lt;p&gt;今天是 9 月 22 日，2026 年还剩最后 100 天。我给自己定了个目标：接下来这 100 天，每天写一篇，写满 100 篇，用 100 篇文章送走 2026。12 月 31 日那天，正好是第 100 篇。&lt;/p&gt;
&lt;p&gt;写什么不设限。可能是 AI 的新东西拆开看，可能是积攒很多老文章选一篇重发，可能是一段代码的折腾记录，也可能就是当天的一点想法。十年前我做到过一周好几篇，现在想试试一天一篇、连着一百天，是什么感觉。&lt;/p&gt;
&lt;p&gt;这个站就是这 100 篇的第一现场，公众号「P小二」同步更新。写不写得满 100 篇我不知道，但今天的债今天还，明天的文章明天见。&lt;/p&gt;
&lt;p&gt;关注我，明天继续。&lt;/p&gt;</content:encoded><category>精神家园</category><category>P小二</category><category>建站</category></item><item><title>三十七岁，和 Agent 一起跑夜路</title><link>https://pxiaoer.blog/posts/2026/%E4%B8%89%E5%8D%81%E4%B8%83%E5%B2%81%E5%92%8C-agent-%E4%B8%80%E8%B5%B7%E8%B7%91%E5%A4%9C%E8%B7%AF/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2026/%E4%B8%89%E5%8D%81%E4%B8%83%E5%B2%81%E5%92%8C-agent-%E4%B8%80%E8%B5%B7%E8%B7%91%E5%A4%9C%E8%B7%AF/</guid><description>机器的递归，是一轮一轮地往上迭代。人的递归，是一年一年地回头看自己，再往前走一步。三十七，也是一轮迭代。</description><pubDate>Sat, 19 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;机器的递归，是一轮一轮地往上迭代。人的递归，是一年一年地回头看自己，再往前走一步。&lt;/p&gt;
&lt;p&gt;三十七，也是一轮迭代。&lt;/p&gt;</content:encoded><category>精神家园</category><category>P小二</category><category>pxiaoer</category></item><item><title>AI创业，怕的不是你被抄了，而是你根本没护城河</title><link>https://pxiaoer.blog/posts/2025/ai%E5%88%9B%E4%B8%9A%E6%80%95%E7%9A%84%E4%B8%8D%E6%98%AF%E4%BD%A0%E8%A2%AB%E6%8A%84%E4%BA%86%E8%80%8C%E6%98%AF%E4%BD%A0%E6%A0%B9%E6%9C%AC%E6%B2%A1%E6%8A%A4%E5%9F%8E%E6%B2%B3/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/ai%E5%88%9B%E4%B8%9A%E6%80%95%E7%9A%84%E4%B8%8D%E6%98%AF%E4%BD%A0%E8%A2%AB%E6%8A%84%E4%BA%86%E8%80%8C%E6%98%AF%E4%BD%A0%E6%A0%B9%E6%9C%AC%E6%B2%A1%E6%8A%A4%E5%9F%8E%E6%B2%B3/</guid><description>引子：Midjourney 没有 App，却走出了一条 $100M 的道路</description><pubDate>Thu, 29 May 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;引子：Midjourney 没有 App，却走出了一条 $100M 的道路&lt;/p&gt;
&lt;p&gt;为什么有的产品不用买广告、不靠渠道，却能“自来水式”增长？&lt;/p&gt;
&lt;p&gt;例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Midjourney 没有 App，只通过 Discord 社群传播；&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Cursor 在 Reddit 引发开发者热议，实现 $100M ARR；&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;一些工具几乎零投放，却成为行业默认标准。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这不是靠“功能”赢的，而是靠 &lt;strong&gt;设计（Design）&lt;/strong&gt;、&lt;strong&gt;分发路径（Distribution）&lt;/strong&gt; 和&lt;strong&gt;网络效应（Network Effects）&lt;/strong&gt; 构建起护城河。&lt;/p&gt;
&lt;h2 id=&quot;一design设计决定是否被喜欢&quot;&gt;一、Design：设计决定是否被喜欢&lt;/h2&gt;
&lt;p&gt;设计不仅是 UI 漂亮，而是：&lt;strong&gt;是否天然顺手，不用教程就会用。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;举例：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Granola&lt;/strong&gt;：通过邮件总结功能嵌入工作流，让用户无需改变行为习惯；&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PlaudAI&lt;/strong&gt;：语音转写设计得足够人性化，让人愿意用嘴说话替代打字，而不是完成任务式的操作。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;👉 设计得好，产品像“second nature”，用起来像本能。&lt;/p&gt;
&lt;h2 id=&quot;二distribution分发路径决定市场规模&quot;&gt;二、Distribution：分发路径决定市场规模&lt;/h2&gt;
&lt;p&gt;分发路径不是广告投放，而是：&lt;strong&gt;产品是否能自然嵌入用户的日常语言和行为。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;成功的产品分发：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;像 Midjourney、Cursor，靠用户自传播；&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;像 Notion、Figma，被人“顺口提起、自然推荐”。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;你要构建的不是推广计划，而是：&lt;strong&gt;一条产品自己会走的传播路径。&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;三network-effects不是社交裂变而是结构性护城河&quot;&gt;三、Network Effects：不是社交裂变，而是结构性护城河&lt;/h2&gt;
&lt;p&gt;真正的网络效应不是“用户越多越便宜”，而是：&lt;strong&gt;每个新用户都提升了整个系统对所有人的价值。&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Dropbox 的共享协作、Notion 的团队编辑；&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AI Agents 的多用户生态；&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;插件系统、共享资源、协同网络……&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;👉 用户之间的连接越多，迁移成本越高，护城河越深。&lt;/p&gt;
&lt;h2 id=&quot;四ai-时代技术优势寿命正在被压缩&quot;&gt;四、AI 时代，技术优势寿命正在被压缩&lt;/h2&gt;
&lt;p&gt;Andrew Chen（a16z）指出：99% 的初创公司在技术上并无显著差异。&lt;/p&gt;
&lt;p&gt;在 AI 时代：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;技术靠开源拼接、API 调用，很快就能复刻；&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;真正决定成败的，是产品有没有持久分发路径（distribution）。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Paul Graham 更直接：&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;“B2B SaaS 不是技术公司，是销售公司。代码不是门槛，GTM 才是。”&lt;/p&gt;
&lt;h2 id=&quot;五真正重要的三件事design-distribution-network-effects&quot;&gt;五、真正重要的三件事：Design. Distribution. Network Effects.&lt;/h2&gt;
&lt;p&gt;Peter Thiel 曾说：&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;“即便产品毫无差异，只要你的 distribution 足够强，也可以建立垄断。”&lt;/p&gt;
&lt;p&gt;维度决定因素定义举例&lt;strong&gt;Design&lt;/strong&gt;注意力不用解释就知道怎么用Granola、PlaudAI&lt;strong&gt;Distribution&lt;/strong&gt;市场自然被用户传播和扩散Discord、Reddit、社区推荐&lt;strong&gt;Network Effect&lt;/strong&gt;护城河每位新用户增强系统整体价值Notion 协作、插件生态&lt;/p&gt;
&lt;h2 id=&quot;六创业者如何构建三重护城河&quot;&gt;六、创业者如何构建三重护城河？&lt;/h2&gt;
&lt;p&gt;✅ &lt;strong&gt;设计产品像是本能反应&lt;/strong&gt;：UI 不是炫技，而是“让人不用想也能上手”。&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;分发路径嵌入语言环境&lt;/strong&gt;：产品要被用户“顺口提起、自然推荐”，而不是靠抽奖裂变。&lt;/p&gt;
&lt;p&gt;✅ &lt;strong&gt;构建结构性用户关系网络&lt;/strong&gt;：设计出用户之间的连接点、协作路径、共建内容。&lt;/p&gt;
&lt;h2 id=&quot;七写在最后&quot;&gt;七、写在最后：&lt;/h2&gt;
&lt;p&gt;很多人说：“我们又被谁谁抄了。”&lt;/p&gt;
&lt;p&gt;但真相是：&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;不是你被抄了，而是你根本没护城河。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在这个技术平权的时代，&lt;strong&gt;分发路径和网络结构才是真正的竞争力。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;如果你真想打造长期产品，不妨换个问题：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;别再问“我们还缺什么功能？”&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;改问：“用户之间，是不是因为我们而连接得更紧密了？”&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>创业笔记</category><category>AI创业</category></item><item><title>2025年4月1日，我开始了AI Bounty旅程</title><link>https://pxiaoer.blog/posts/2025/aibounty/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/aibounty/</guid><description>2025年4月第一天，我开始了一件事，那就是AI Bounty。后面每天都会花一些时间在上面，期待有好的结果。</description><pubDate>Tue, 01 Apr 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;2025年4月第一天，我开始了一件事，那就是AI Bounty。后面每天都会花一些时间在上面，期待有好的结果。&lt;/p&gt;
&lt;p&gt;我会通过&lt;a href=&quot;https://aipwn.org/&quot;&gt;AIPwn.org&lt;/a&gt;随时同步我的研究经历和结果，有兴趣的可以关注一下。&lt;/p&gt;
&lt;h3 id=&quot;llm时代的模型安全&quot;&gt;LLM时代的模型安全&lt;/h3&gt;
&lt;p&gt;上个月给一个大公司做了一下模型安全的talk，下面的当时的slides的几个截图，slides的link放在了最后，欢迎交流。&lt;/p&gt;
&lt;p&gt;[&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c9e5e84-520f-4f28-ae2e-a97337d6f407_2206x1238.png&quot; alt=&quot;上个月给一个大公司做了一下模型安全的talk，下面的当时的slides的几个截图&quot;&gt;&lt;/p&gt;
&lt;p&gt;](&lt;a href=&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c9e5e84-520f-4f28-ae2e-a97337d6f407_2206x1238.png&quot;&gt;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c9e5e84-520f-4f28-ae2e-a97337d6f407_2206x1238.png&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;[&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd65a56e-ac0c-4de2-a32e-51bf93984495_2078x1186.png&quot; alt=&quot;上个月给一个大公司做了一下模型安全的talk，下面的当时的slides的几个截图&quot;&gt;&lt;/p&gt;
&lt;p&gt;](&lt;a href=&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd65a56e-ac0c-4de2-a32e-51bf93984495_2078x1186.png&quot;&gt;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd65a56e-ac0c-4de2-a32e-51bf93984495_2078x1186.png&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;[&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://substackcdn.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7368f3eb-a5d6-44e3-8b72-bc05f7ec951f_2050x1160.png&quot; alt=&quot;上个月给一个大公司做了一下模型安全的talk，下面的当时的slides的几个截图&quot;&gt;&lt;/p&gt;
&lt;p&gt;](&lt;a href=&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7368f3eb-a5d6-44e3-8b72-bc05f7ec951f_2050x1160.png&quot;&gt;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7368f3eb-a5d6-44e3-8b72-bc05f7ec951f_2050x1160.png&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;slides link： &lt;a href=&quot;https://docs.google.com/presentation/d/1xgkv55cnTsAMaW0uvBOhLWhsgoQnoShBWTvbpGj4Hhk/edit?usp=sharing&quot;&gt;LLM时代的模型安全&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;ai-bounty-重点关注什么&quot;&gt;AI Bounty 重点关注什么&lt;/h3&gt;
&lt;p&gt;目前还处理学习阶段，基本所有的内容都会过一遍，现在接受AI漏洞的厂商其实还很少，最有可能还是从AI Infra入手。&lt;/p&gt;
&lt;p&gt;当然也会包括最新的一些东西，比如我上面Slides讲的Agent安全，还有最近非常火的&lt;a href=&quot;https://arxiv.org/abs/2503.23278&quot;&gt;MCP协议安全&lt;/a&gt;。今年算是Agent元年，所以很多精力会放在Agent扩大的攻击面上。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2025/04/image-1.png&quot; alt=&quot;当然也会包括最新的一些东西，比如我上面Slides讲的Agent安全，还有最近非&quot;&gt;&lt;/p&gt;
&lt;p&gt;我还会写一些AI安全相关的开源项目，到时也会通过&lt;a href=&quot;https://aipwn.org/&quot;&gt;AIPwn.org&lt;/a&gt;进行公布。希望，2025年，大家都有所收获。&lt;/p&gt;
&lt;p&gt;我的X: &lt;a href=&quot;https://x.com/pxiaoer&quot;&gt;pxiaoer&lt;/a&gt; 欢迎多交流。&lt;/p&gt;</content:encoded><category>AIPwn</category><category>AIBounty</category><category>AI安全</category><category>漏洞挖掘</category></item><item><title>DeepSeek开源周第六天：DeepSeek-V3 / R1 推理系统概览深度分析</title><link>https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E5%85%AD%E5%A4%A9deepseek-v3-r1-%E6%8E%A8%E7%90%86%E7%B3%BB%E7%BB%9F%E6%A6%82%E8%A7%88%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E5%85%AD%E5%A4%A9deepseek-v3-r1-%E6%8E%A8%E7%90%86%E7%B3%BB%E7%BB%9F%E6%A6%82%E8%A7%88%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</guid><description>deepseek的One More Thing来了</description><pubDate>Sat, 01 Mar 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;今天十二点，deepseek 带来了一个开源周的One More Thing，介绍了DeepSeek-V3 / R1 推理系统的一些信息和成本计算，你一定感兴趣。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/954c92e666e231e9.png&quot; alt=&quot;今天十二点，deepseek 带来了一个开源周的One More Thing，介&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;推理系统设计原则&quot;&gt;推理系统设计原则&lt;/h2&gt;
&lt;h2 id=&quot;&quot;&gt;&lt;/h2&gt;
&lt;p&gt;deepseek先介绍了推理系统的设计原则，推理系统的优化目标：&lt;strong&gt;更大的吞吐，更低的延迟。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/a5c3b8b7e7fa089b.png&quot; alt=&quot;deepseek先介绍了推理系统的设计原则，推理系统的优化目标： 更大的吞吐，更&quot;&gt;&lt;/p&gt;
&lt;p&gt;参考的架构图&lt;/p&gt;
&lt;p&gt;deepseek目前采用的方案：大规模节点专家并行&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;EP 使得 batch size 大大增加，从而提高 GPU 矩阵乘法的效率，提高吞吐。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;EP 使得专家分散在不同的 GPU 上，每个 GPU 只需要计算很少的专家（因此更少的访存需求），从而降低延迟。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;引入的复杂性：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;EP 引入跨节点的传输。为了优化吞吐，需要设计合适的计算流程使得传输和计算可以同步进行。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;EP 涉及多个节点，因此天然需要 Data Parallelism（DP），不同的 DP 之间需要进行负载均衡。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;大规模跨节点专家并行&quot;&gt;大规模跨节点专家并行&lt;/h2&gt;
&lt;h2 id=&quot;-1&quot;&gt;&lt;/h2&gt;
&lt;p&gt;deepseek采用的是&lt;strong&gt;多机多卡&lt;/strong&gt;的专家并行策略：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Prefill：路由专家 EP32、MLA 和共享专家 DP32，一个部署单元是 4 节点，32 个冗余路由专家，每张卡 9 个路由专家和 1 个共享专家&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Decode：路由专家 EP144、MLA 和共享专家 DP144，一个部署单元是 18 节点，32 个冗余路由专家，每张卡 2 个路由专家和 1 个共享专家&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;多机多卡的专家并行引入比较大的通信开销，所以使用了双 batch 重叠来掩盖通信开销，提高整体吞吐。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;prefill 阶段，两个 batch 的计算和通信交错进行，一个 batch 在进行计算的时候可以去掩盖另一个 batch 的通信开销；&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/8a63d4019630fb5c.png&quot; alt=&quot;prefill 阶段，两个 batch 的计算和通信交错进行，一个 batch&quot;&gt;&lt;/p&gt;
&lt;p&gt;decode 阶段，不同阶段的执行时间有所差别，所以我们把 attention 部分拆成了两个 stage，共计 5 个 stage 的流水线来实现计算和通信的重叠。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/e1cd5cb00c0e04ff.png&quot; alt=&quot;decode 阶段，不同阶段的执行时间有所差别，所以我们把 attention&quot;&gt;&lt;/p&gt;
&lt;p&gt;因为使用了大规模并行（包括专家并行/数据并行）时，就存在某些GPU过载的情况，需要做计算负载均衡和通信负载均衡。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Prefill Load Balancer&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;核心问题：不同数据并行（DP）实例上的请求个数、长度不同，导致 core-attention 计算量、dispatch 发送量也不同&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;优化目标：各 GPU 的计算量尽量相同（core-attention 计算负载均衡）、输入的 token 数量也尽量相同（dispatch 发送量负载均衡），避免部分 GPU 处理时间过长&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Decode Load Balancer&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;核心问题：不同数据并行（DP）实例上的请求数量、长度不同，导致 core-attention 计算量（与 KVCache 占用量相关）、dispatch 发送量不同&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;优化目标：各 GPU 的 KVCache 占用量尽量相同（core-attention 计算负载均衡）、请求数量尽量相同（dispatch 发送量负载均衡）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Expert-Parallel Load Balancer&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;核心问题：对于给定 MoE 模型，存在一些天然的高负载专家（expert），导致不同 GPU 的专家计算负载不均衡&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;优化目标：每个 GPU 上的专家计算量均衡（即最小化所有 GPU 的 dispatch 接收量的最大值）&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;线上推理系统的实际统计数据&quot;&gt;线上推理系统的实际统计数据&lt;/h2&gt;
&lt;h2 id=&quot;-2&quot;&gt;&lt;/h2&gt;
&lt;p&gt;DeepSeek R1/V3所有服务都使用H800，矩阵计算和 dispatch 传输采用和训练一致的 FP8 格式，core-attention 计算和 combine 传输采用和训练一致的 BF16，最大程度保证了服务效果。&lt;/p&gt;
&lt;p&gt;因为服务白天负载高，晚上负载低，所以负载高的时候全服务器做推理，负载低的时候腾一些机器出来做研究和训练。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/e3737bb844059148.png&quot; alt=&quot;因为服务白天负载高，晚上负载低，所以负载高的时候全服务器做推理，负载低的时候腾一&quot;&gt;&lt;/p&gt;
&lt;p&gt;在最近的 24 小时里（北京时间 2025/02/27 12:00 至 2025/02/28 12:00），DeepSeek V3 和 R1 推理服务占用节点总和，峰值占用为 278 个节点，平均占用 226.75 个节点（每个节点为 8 个 H800 GPU）。假定 GPU 租赁成本为 2 美金/小时，总成本为 &lt;strong&gt;$87,072&lt;/strong&gt;/天。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;在 24 小时统计时段内，DeepSeek V3 和 R1：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;输入 token 总数为 608B，其中 342B tokens（56.3%）命中 KVCache 硬盘缓存。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;输出 token 总数为 168B。平均输出速率为 20~22 tps，平均每输出一个 token 的 KVCache 长度是 4989。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;平均每台 H800 的吞吐量为：对于 prefill 任务，输入吞吐约 73.7k tokens/s（含缓存命中）；对于 decode 任务，输出吞吐约 14.8k tokens/s。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;以上统计包括了网页、APP 和 API 的所有负载。如果所有 tokens 全部按照 DeepSeek R1 的定价计算，理论上一天的总收入为 &lt;strong&gt;$562,027&lt;/strong&gt;，成本利润率 545%。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/d1f3d280b0ec2e1a.png&quot; alt=&quot;以上统计包括了网页、APP 和 API 的所有负载。如果所有 tokens 全部&quot;&gt;&lt;/p&gt;
&lt;p&gt;实际上deepseek 是没有这么多收入，因为 V3 的定价更低，同时收费服务只占了一部分，另外夜间还会有折扣。&lt;/p&gt;
&lt;h2 id=&quot;我们能得到什么信息&quot;&gt;我们能得到什么信息&lt;/h2&gt;
&lt;h2 id=&quot;-3&quot;&gt;&lt;/h2&gt;
&lt;p&gt;前段时间传的，deepseek官方部署的是320张H800的一个推理集群，目前看来应该278个节点，2224张H800的集群，官方承认至少拥有一万张H800，用来做推理的GPU真不算多。&lt;/p&gt;
&lt;p&gt;成本： 平均226.75节点，1814张，一张卡2刀/h， 一天成本$87,072&lt;/p&gt;
&lt;p&gt;收入:    输入：608B 输出：168B， 算下来一天收入 &lt;strong&gt;$562,027&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;那么一天毛收入：$&lt;strong&gt;474&lt;/strong&gt;,955 = 日入 3457672.4 RMB&lt;/p&gt;
&lt;p&gt;其实上面的算法是很有问题的，即使6倍利润算变成3倍，那利润率也是非常高的，国内很多厂商部署deepseek还因为亏钱关闭API服务，是时候想想问题出在哪里了。&lt;/p&gt;
&lt;p&gt;梁文锋在接受采访的时候说过：我们只是按照自己的步调来做事，然后核算成本定价。我们的&lt;strong&gt;原则是不贴钱。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;这其实说明deepseek目前应该是赚钱的， 而且赚的钱应该都用到继续投入研发了，期待R2尽快出来。&lt;/p&gt;
&lt;p&gt;关注我，我们一起猛学。&lt;/p&gt;
&lt;p&gt;往期分析文章：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126565&amp;#x26;idx=1&amp;#x26;sn=d7539f1faad0d04128cb2d5795003a75&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第五天：3FS和Smallpond深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126551&amp;#x26;idx=1&amp;#x26;sn=c6e77cfcbfbd8fd7b1644b34d95b3938&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第四天：DualPipe&amp;#x26;EPLB深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126541&amp;#x26;idx=1&amp;#x26;sn=61bb2095ef386c9bfa8a83780c01d430&amp;#x26;scene=21#wechat_redirect&quot;&gt;deepseek开源周第三天：DeepGEMM深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126526&amp;#x26;idx=1&amp;#x26;sn=a65f1ebcd609553daf057a11423996f3&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第二天：DeepEP深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126513&amp;#x26;idx=1&amp;#x26;sn=325c82d7c75a8ceb3f7bcfd63280d72e&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第一天：FlashMLA 深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126493&amp;#x26;idx=1&amp;#x26;sn=e0082b3ac23090cf9a363209f887c4e4&amp;#x26;scene=21#wechat_redirect&quot;&gt;开源周来袭：DeepSeek有哪些神秘技术即将公开？&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;参考链接：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/open-infra-index/blob/main/202502OpenSourceWeek/day_6_one_more_thing_deepseekV3R1_inference_system_overview.md&quot;&gt;https://github.com/deepseek-ai/open-infra-index/blob/main/202502OpenSourceWeek/day_6_one_more_thing_deepseekV3R1_inference_system_overview.md&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://zhuanlan.zhihu.com/p/27181462601&quot;&gt;https://zhuanlan.zhihu.com/p/27181462601&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>AI Research</category><category>deepseek</category><category>开源</category><category>大模型</category></item><item><title>DeepSeek开源周第五天：3FS和Smallpond深度分析</title><link>https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%BA%94%E5%A4%A93fs%E5%92%8Csmallpond%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%BA%94%E5%A4%A93fs%E5%92%8Csmallpond%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</guid><description>感谢deepseek，实实在在开源了一些好东西</description><pubDate>Fri, 28 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;2月的最后一天，也是deepseek开源周的最后一天，deepseek开源了两个项目，他们是：3FS和smallpond。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/9094815343444598.png&quot; alt=&quot;2月的最后一天，也是deepseek开源周的最后一天，deepseek开源了两个&quot;&gt;&lt;/p&gt;
&lt;p&gt;官方介绍，火萤文件系统 (3FS) 是 一种并行文件系统，充分利用现代 SSD 和 RDMA 网络的全部带宽。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;在 180 节点集群中实现 6.6 TiB/s 的总读取吞吐量&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在 25 节点集群的 GraySort 基准测试中实现 3.66 TiB/分钟的吞吐量&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;每个客户端节点在 KVCache 查找中实现 40+ GiB/s 的峰值吞吐量&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;具有强一致性语义的分布式架构&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;用于 V3/R1 的训练数据预处理、数据集加载、检查点保存/重新加载、嵌入向量搜索及推理中的 KVCache 查找&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Smallpond ，则是一个基于 3FS 的数据处理框架。&lt;/p&gt;
&lt;h2 id=&quot;fire-flyer-file-system-3fs&quot;&gt;Fire-Flyer File System (3FS)&lt;/h2&gt;
&lt;p&gt;3FS是deepseek开发的Fire-Flyer AI-HPC的一部分，在论文Fire-Flyer AI-HPC: A Cost-Effective Software-Hardware Co-Design for Deep Learning有详细的介绍。&lt;/p&gt;
&lt;p&gt;Fire-Flyer AI-HPC有三个部分，HAI Platform 两年前就开源了，3FS今天也开源了，只剩下HaiScale还没开源。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/6e7217239fa24903.png&quot; alt=&quot;Fire Flyer AI HPC有三个部分，HAI Platform 两年前就&quot;&gt;&lt;/p&gt;
&lt;p&gt;总结来说，3FS有几个特点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;高性能设计：3FS专为充分利用NVMe SSD的高输入输出操作每秒（IOPS）和高吞吐量以及RDMA网络而设计。通过这样的设计，3FS能够高效地处理大量数据请求，满足深度学习和大规模计算的需求。&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;系统架构：3FS系统由四个角色组成：集群管理器、元服务、存储服务和客户端。元服务和存储服务定期向集群管理器发送心跳信号，确保系统稳定和高效运行。多个集群管理器的设置保证了系统的高可用性。&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;请求控制机制：3FS实现了一种请求发送控制机制，以减轻网络拥塞。在客户端接收到读取请求后，存储服务会请求客户端允许传输数据。这种机制限制了并发发送者的数量，有助于在高负载情况下保持良好的性能。&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;强一致性与链复制：3FS采用链复制和分配查询（CRAQ）方法，以提供强一致性。文件内容被切分为多个块，并在一系列存储目标上进行复制，这样可以充分释放所有SSD的吞吐量和IOPS。&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;高吞吐量：通过优化批量写入和读取操作，3FS能够实现每个节点超过10 GiB/s的写入速度，从而加快了检查点保存和加载的过程，降低了训练过程中的延迟。&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;3FS-KV系统：3FS还支持3FS-KV，这是一个基于3FS构建的共享存储分布式数据处理系统，支持键值存储、消息队列和对象存储模型，进一步提升了系统的灵活性和性能。&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;3FS在深度学习和大规模计算中提供了强大的存储支持，有效满足了高吞吐量和低延迟的需求。&lt;/p&gt;
&lt;p&gt;论文的描述如下：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/436ab056f3c01daa.png&quot; alt=&quot;论文的描述如下&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/d5ff0b400755b19a.png&quot; alt=&quot;论文的描述如下&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/b15bcf46809e7941.png&quot; alt=&quot;论文的描述如下&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;性能&quot;&gt;性能&lt;/h3&gt;
&lt;h4 id=&quot;峰值吞吐量&quot;&gt;峰值吞吐量&lt;/h4&gt;
&lt;p&gt;一个大型 3FS 集群的读压测吞吐情况。该集群由 180 个存储节点组成，每个存储节点配备 2×200Gbps InfiniBand 网卡和 16 个 14TiB NVMe SSD。大约 500+ 个客户端节点用于读压测，每个客户端节点配置 1x200Gbps InfiniBand 网卡。在训练作业的背景流量下，最终聚合读吞吐达到约 6.6 TiB/s&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/e4a7a067bbee0f17.png&quot; alt=&quot;一个大型 3FS 集群的读压测吞吐情况。该集群由 180 个存储节点组成，每个存&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;排序性能&quot;&gt;排序性能&lt;/h4&gt;
&lt;p&gt;测试集群由 25 个存储节点（2 个 NUMA 域/节点、1 个存储服务/NUMA、2×400Gbps NIC/节点）和 50 个计算节点（2 个 NUMA 域、192 个物理核心、2.2 TiB RAM 和 1×200 Gbps NIC/节点）组成。对 8192 个分区中的 110.5 TiB 数据进行排序耗时 30 分 14 秒，平均吞吐量为&lt;em&gt;3.66 TiB/分钟&lt;/em&gt;。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/bb92593344c6b7df.png&quot; alt=&quot;测试集群由 25 个存储节点（2 个 NUMA 域/节点、1 个存储服务/NUM&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;kvcache&quot;&gt;KVCache&lt;/h4&gt;
&lt;p&gt;KVCache 是一种用于优化LLM推理过程。它通过在解码器层中缓存先前标记的键和值向量来避免冗余计算。上图展示了所有 KVCache 客户端的读取吞吐量，突出显示了峰值和平均值，峰值吞吐量高达 40 GiB/s。下图显示了同一时间段内垃圾收集 (GC) 中删除操作的 IOPS。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/844bbc875d368eab.png&quot; alt=&quot;KVCache 是一种用于优化LLM推理过程。它通过在解码器层中缓存先前标记的键&quot;&gt;&lt;/p&gt;
&lt;p&gt;为什么需要3FS这种特殊的文件系统？其实是因为在LLM 场景下需要高并发、高吞吐、可扩展的分布式文件系统，同时对一致性、智能路由、缓存管理等提出了更高要求。因此，像 3FS 这样能够提供面向 RDMA 与 SSD 的高性能解决方案、更灵活的元数据设计、以及异步零拷贝 IO 的系统，就显得很有价值。&lt;/p&gt;
&lt;h2 id=&quot;代码分析&quot;&gt;代码分析&lt;/h2&gt;
&lt;p&gt;3FS这个高性能文件系统的实现中，有一点必须提一下，就是deepseek使用Rust来实现了&lt;strong&gt;chunk_engine。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;chunk_engine是块引擎，是3FS存储服务底层的核心模块之一，负责磁盘物理块的管理、分配和回收，上层可以通过块引擎对块数据进行读写。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;chunk_engine主要使用了cxx自动生成C++绑定，让C++代码直接调用Rust代码。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;最近几年，Rust在mlsys领域使用频率越来越多，包括huggingface开发的tokenizers也是Rust实现的。deepseek团队选择Rust来实现chunk_engine可能也是觉得Rust的代码好维护，内存安全，性能也很好的优点。&lt;/p&gt;
&lt;p&gt;deepseek团队应该在后台服务中也使用了Rust的框架 tokio，因为我在幻方AI的开源项目找到了几个Rust开源项目，而且包含了tokio。真心希望越来越多的团队多多使用Rust来开发机器学习系统。&lt;/p&gt;
&lt;h2 id=&quot;smallpond&quot;&gt;Smallpond&lt;/h2&gt;
&lt;p&gt;Smallpond是一个轻量级的数据处理框架，构建于 DuckDB 和 3FS 之上，支持轻量级、高性能的数据处理，可扩展至 PB 级数据集。&lt;/p&gt;
&lt;p&gt;安装和使用都比较简单，API不多，提供两种不同的API，分别支持动态和静态构建数据流图。&lt;/p&gt;
&lt;p&gt;安装：&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;pip&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; install&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; smallpond&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;使用例子：&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;# Download example data&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;wget&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; https://duckdb.org/data/prices.parquet&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; smallpond&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;# Initialize session&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;sp &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; smallpond.init()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;# Load data&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;df &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; sp.read_parquet(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;prices.parquet&quot;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;# Process data&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;df &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; df.repartition(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;hash_by&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;ticker&quot;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;df &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; sp.partial_sql(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;SELECT ticker, min(price), max(price) FROM &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{0}&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; GROUP BY ticker&quot;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, df)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;# Save results&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;df.write_parquet(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;output/&quot;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;# Show results&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(df.to_pandas())&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;性能可以参考3FS 排序的性能。&lt;/p&gt;
&lt;p&gt;deepseek开源周，到今天算是结束了，感谢deepseek，实实在在拿出了好东西供大家学习和使用。&lt;/p&gt;
&lt;p&gt;很多团队已经在行动，得到了实际的性能提升。比如：vLLM团队把TRITON_MLA换成了FLASHMLA，吞吐量提升了2-16%，真正得到了好的结果。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/0d631abd4682d4a2.png&quot; alt=&quot;很多团队已经在行动，得到了实际的性能提升。比如：vLLM团队把TRITON ML&quot;&gt;&lt;/p&gt;
&lt;p&gt;deepseek开源的这些项目，后面还持续影响着我们。我们的猛学之旅，还在继续。&lt;/p&gt;
&lt;p&gt;关注我，明天继续。&lt;/p&gt;
&lt;p&gt;往期分析文章：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126551&amp;#x26;idx=1&amp;#x26;sn=c6e77cfcbfbd8fd7b1644b34d95b3938&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第四天：DualPipe&amp;#x26;EPLB深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126541&amp;#x26;idx=1&amp;#x26;sn=61bb2095ef386c9bfa8a83780c01d430&amp;#x26;scene=21#wechat_redirect&quot;&gt;deepseek开源周第三天：DeepGEMM深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126526&amp;#x26;idx=1&amp;#x26;sn=a65f1ebcd609553daf057a11423996f3&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第二天：DeepEP深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126513&amp;#x26;idx=1&amp;#x26;sn=325c82d7c75a8ceb3f7bcfd63280d72e&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第一天：FlashMLA 深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126493&amp;#x26;idx=1&amp;#x26;sn=e0082b3ac23090cf9a363209f887c4e4&amp;#x26;scene=21#wechat_redirect&quot;&gt;开源周来袭：DeepSeek有哪些神秘技术即将公开？&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;参考链接：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/3FS&quot;&gt;https://github.com/deepseek-ai/3FS&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/smallpond&quot;&gt;https://github.com/deepseek-ai/smallpond&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2408.14158&quot;&gt;https://arxiv.org/abs/2408.14158&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/huggingface/tokenizers&quot;&gt;https://github.com/huggingface/tokenizers&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/HFAiLab/hai-platform&quot;&gt;https://github.com/HFAiLab/hai-platform&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://x.com/vllm_project/status/1894994674630435123&quot;&gt;https://x.com/vllm_project/status/1894994674630435123&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>AI Research</category><category>deepseek</category><category>开源</category><category>大模型</category></item><item><title>DeepSeek开源周第四天：DualPipe&amp;EPLB深度分析</title><link>https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E5%9B%9B%E5%A4%A9dualpipeeplb%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E5%9B%9B%E5%A4%A9dualpipeeplb%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</guid><description>deepseek开源周第四天，你需要的项目深度分析来了</description><pubDate>Thu, 27 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;今天是deepseek 开源周的第四天，deepseek带来了三个项目，全部都是关于V3/R1训练和推理相关的并行策略优化。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/488d31ae172432ff.png&quot; alt=&quot;今天是deepseek 开源周的第四天，deepseek带来了三个项目，全部都是&quot;&gt;&lt;/p&gt;
&lt;p&gt;DualPipe是一种用于V3/R1训练中计算-通信重叠的双向流水线并行算法。而EPLB是用于V3/R1的专家并行负载均衡器。&lt;/p&gt;
&lt;p&gt;最后一个profile-data主要是公开deepseek infra的训练和推理的分析数据，目前公开了训练和推理中Prefilling的分析数据，推理的Decoding分析数据还没有公开。&lt;/p&gt;
&lt;p&gt;今天主要带来DualPipe和EPLB项目的分析，这两个都偏向于工程优化。&lt;/p&gt;
&lt;h2 id=&quot;dualpipe&quot;&gt;DualPipe&lt;/h2&gt;
&lt;p&gt;DualPipe在deepseek V3论文中有提到，是一种双向流水线并行通信的算法，主要用于优化大模型的数据交互和训练效率。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/2c9710628887fcc0.png&quot; alt=&quot;DualPipe在deepseek V3论文中有提到，是一种双向流水线并行通信的&quot;&gt;&lt;/p&gt;
&lt;p&gt;主要的核心特点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;计算与通信重叠   DualPipe的设计目标是最大化集群的计算性能，在前向传播和后向传播中实现计算与通信的完全重叠，减少传统流水线并行中的空闲等待时间。 在MoE模型的跨节点写作的专家并行（Expert Parallelism）尤其重要。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;双向调度  DualPipe 是双向调度策略，主要是从流水线的两端同时输入，重复利用硬件资源。还设计了一个复杂但很高效的8步调度策略。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;显存优化&lt;/p&gt;
&lt;p&gt;DualPipe 将模型的最浅层（包括嵌入层）和最深层（包括输出层）部署在同一流水线级别（PP Rank），实现参数和梯度的物理共享，进一步提升内存效率&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/e8ead342089cea4c.png&quot; alt=&quot;DualPipe 将模型的最浅层（包括嵌入层）和最深层（包括输出层）部署在同一流&quot;&gt;&lt;/p&gt;
&lt;p&gt;管道气泡和内存使用情况比较 (管道气泡，即空闲等待时间）&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/fe4c293597bfd4b3.png&quot; alt=&quot;管道气泡和内存使用情况比较 (管道气泡，即空闲等待时间）&quot;&gt;&lt;/p&gt;
&lt;p&gt;有兴趣可以具体去看代码，代码行数并不多，适合学习。&lt;/p&gt;
&lt;h2 id=&quot;&quot;&gt;&lt;/h2&gt;
&lt;h2 id=&quot;eplb&quot;&gt;EPLB&lt;/h2&gt;
&lt;p&gt;EPLB （Expert Parallelism Load Balancer，专家并行负载均衡器）是主要用于优化MoE的分布式部署，方法是为保证MoE部分不同专家之间的负载均衡，会将共享专家和高负载的细粒度专家在集群的不同GPU做多个复制，让GPU把更多的热数据（发给共享专家的）跑起来。&lt;/p&gt;
&lt;p&gt;EPLB在deepseek的论文中没有相应的介绍，它的代码也只有160行，非常的简洁。&lt;/p&gt;
&lt;p&gt;主要的核心特点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;负载均衡优化&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;主要是复制高负载的专家(可以称为：冗余专家策略)并对专家分配进行启发式的调整，确保不同GPU之间的负载均衡。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;分层负载均衡&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;采用三层结构:节点级→节点内专家复制→GPU分配，优先保证同一组的专家尽量分配到同一个节点，减少跨节点的数据传输，然后在每一层都保证负载均衡。这种应用在deepseek V3中的分组限制路由（Group-Limited Expert Routing）策略显著提升了分布式训练的效率。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;动态调度策略&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;根据实际情况动态选择负载均衡策，预填充阶段使用分层策略和解码阶段使用全局策略&lt;/p&gt;
&lt;p&gt;我们分别来看代码：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;冗余专家策略&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; replicate_experts&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(weight: torch.Tensor, num_phy: &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 对负载较重的专家进行复制&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; range&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(num_log, num_phy):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        redundant_indices &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; (weight &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; logcnt).max(&lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;dim&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=-&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;).indices&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        phy2log[:, i] &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; redundant_indices&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        logcnt[arangen, redundant_indices] &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;分层负载均衡&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; rebalance_experts_hierarchical&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # Step 1: 将专家组打包到节点&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    tokens_per_group &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; weight.unflatten(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, (num_groups, group_size)).sum(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    group_pack_index, group_rank_in_pack &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; balanced_packing(tokens_per_group, num_nodes)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # Step 2: 在节点内构建冗余专家&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    tokens_per_mlog &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; weight.gather(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, mlog2log).view(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, num_logical_experts &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; num_nodes)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # Step 3: 将物理专家打包到GPU&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    tokens_per_phy &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; (tokens_per_mlog &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; mlogcnt).gather(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, phy2mlog)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;动态调度策略&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; rebalance_experts&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; num_groups &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; num_nodes &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 0&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;        # 使用分层策略&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        phy2log, phyrank, logcnt &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; rebalance_experts_hierarchical()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    else&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;        # 使用全局策略&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        phy2log, phyrank, logcnt &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; replicate_experts()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;有兴趣的同学可以去看具体的代码。&lt;/p&gt;
&lt;p&gt;明天是deepseek开源周的最后一天，会不会放出一个重量级的开源项目呢，让我们拭目以待。&lt;/p&gt;
&lt;p&gt;关注我，让我们一起猛学！&lt;/p&gt;
&lt;p&gt;往期分析文章：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126541&amp;#x26;idx=1&amp;#x26;sn=61bb2095ef386c9bfa8a83780c01d430&amp;#x26;scene=21#wechat_redirect&quot;&gt;deepseek开源周第三天：DeepGEMM深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126526&amp;#x26;idx=1&amp;#x26;sn=a65f1ebcd609553daf057a11423996f3&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第二天：DeepEP深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126513&amp;#x26;idx=1&amp;#x26;sn=325c82d7c75a8ceb3f7bcfd63280d72e&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第一天：FlashMLA 深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126493&amp;#x26;idx=1&amp;#x26;sn=e0082b3ac23090cf9a363209f887c4e4&amp;#x26;scene=21#wechat_redirect&quot;&gt;开源周来袭：DeepSeek有哪些神秘技术即将公开？&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;参考链接：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/DualPipe&quot;&gt;https://github.com/deepseek-ai/DualPipe&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/eplb&quot;&gt;https://github.com/deepseek-ai/eplb&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/profile-data&quot;&gt;https://github.com/deepseek-ai/profile-data&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>AI Research</category><category>deepseek</category><category>开源</category><category>ai</category></item><item><title>deepseek开源周第三天：DeepGEMM深度分析</title><link>https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%B8%89%E5%A4%A9deepgemm%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%B8%89%E5%A4%A9deepgemm%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</guid><description>今天带来deepseek开源DeepGEMM深度分析</description><pubDate>Wed, 26 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;今天，deepseek开源周第三天，9点准时发布，这次是DeepGEMM。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/2d3db08d2452e461.png&quot; alt=&quot;今天，deepseek开源周第三天，9点准时发布，这次是DeepGEMM。&quot;&gt;&lt;/p&gt;
&lt;p&gt;发布后，目前项目3.3k star。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/1ae23da7e507158c.png&quot; alt=&quot;发布后，目前项目3.3k star。&quot;&gt;&lt;/p&gt;
&lt;p&gt;官方介绍 DeepGEMM是一款支持 FP8 的 GEMM 库，兼容稠密和 MoE GEMM，用于 V3/R1 的训练和推理。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;⚡ 在 Hopper GPU 上可达 1350+ FP8 TFLOPS&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 无繁重依赖，简单如教程&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 完全即时编译 (Just-In-Time compiled)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 核心逻辑仅 ~300 行代码，却在大多数矩阵规模上超越专家优化的内核性能&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 支持稠密布局和两种 MoE 布局&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;GEMM简单介绍&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;通用矩阵乘法（GEMM）是深度学习和科学计算中最基础也是最重要的计算操作之一。GEMM 代表 General Matrix Multiplication，即两个矩阵 A 和 B 相乘得到结果矩阵 C 的操作，通常表示为 C = A × B。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/959d020f14ec3942.png&quot; alt=&quot;通用矩阵乘法（GEMM）是深度学习和科学计算中最基础也是最重要的计算操作之一。G&quot;&gt;&lt;/p&gt;
&lt;p&gt;在深度学习中，GEMM 是全连接层、卷积层和注意力机制等核心组件的基础。例如，在 Transformer 架构中，自注意力和前馈网络层都大量依赖矩阵乘法。随着模型规模的增长，GEMM 操作占据了模型训练和推理过程中的大部分计算时间，因此 GEMM 的性能直接影响整个深度学习系统的效率。&lt;/p&gt;
&lt;p&gt;现代 GPU 架构专门为加速矩阵乘法而设计，如 NVIDIA 的 Tensor Core 技术。随着 模型规模的不断扩大，对 GEMM 性能的要求也越来越高。特别是在LLM和MoE中，高效的 GEMM 实现对于实现实时推理和降低训练成本至关重要。&lt;/p&gt;
&lt;p&gt;在deepseek发表的论文DeepSeek LLM Scaling Open-Source Language Models with Longtermism 中有提到GEMM，不过都是和他们另外一篇Fire-Flyer AI-HPC: A Cost-Effective Software-Hardware Co-Design for Deep Learning 中介绍的HAI-LLM训练系统有关，有兴趣可以去读一下Fire-Flyer AI-HPC这篇论文。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/0f4b5bda61905a4f.png&quot; alt=&quot;在deepseek发表的论文DeepSeek LLM Scaling Open&quot;&gt;&lt;/p&gt;
&lt;p&gt;今天开源的DeepGEMM 是支持FP8的，主要是用于DeepSeek V3/R1的训练和推理的，在V3论文中deepseek为FP8训练做了许多优化。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/be7c4064937fad7f.png&quot; alt=&quot;今天开源的DeepGEMM 是支持FP8的，主要是用于DeepSeek V3/R&quot;&gt;&lt;/p&gt;
&lt;p&gt;使用FP8做训练的主要挑战是在于精度与误差处理，deepseek为了支持FP8训练做了以下的优化措施：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;细粒度量化：将数据分成更小的组，每个组使用特定乘数来保持高精度。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在线量化：在线计算每1x128激活块或128x128权重块的权重值，在线推算缩放因子，激活或者在线转换为FP8格式&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;提高累加精度：FP8大量累加容易出现随机误差，将中间结果存储在FP32中，累加之后在转化回来。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;低精度/混合精度存储于通信：训练MoE模型时，混合使用FP8和BF16/FP32，确定模型的动态稳定。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;详细的优化措施，有兴趣可以去看deepseek V3的论文。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/5a63fe54356fe2dd.png&quot; alt=&quot;详细的优化措施，有兴趣可以去看deepseek V3的论文。&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;deepgemm介绍&quot;&gt;DeepGEMM介绍&lt;/h2&gt;
&lt;h2 id=&quot;&quot;&gt;&lt;/h2&gt;
&lt;p&gt;总结它的主要特点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;支持FP8：DeepGEMM采用了 CUDA 核心两级累加（解决不精确的问题）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;支持分组GEMM：主要是改进了CUTLASS的分组GEMM，对MoE模型针对性优化&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;即时编译： 通过 JIT 技术，代码可以在运行时动态生成和优化，进一步提升性能和灵活性&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;FFMA SASS 交错：deepseek深入分析了SASS编译结果，在FFMA/FADD中调整SASS指令，提高了细粒度 FP8 GEMM效率&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;性能&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/d7d1a5823355c688.png&quot; alt=&quot;FFMA SASS 交错：deepseek深入分析了SASS编译结果，在FFMA&quot;&gt;&lt;/p&gt;
&lt;p&gt;所有指标都有提高，最高一项有2.7倍加速。deepseek认为在某些地方表现并不太好，有兴趣优化还可以给他们提PR。&lt;/p&gt;
&lt;p&gt;在DeepGEMM 项目的README文档中，deepseek团队还对DeepGEMM的优化做了详细的介绍，有兴趣可以结合代码仔细阅读和测试。&lt;/p&gt;
&lt;p&gt;今天主要介绍项目中的一个文件，在jit目录下有个interleave_ffma.py文件，里面有一些骚操作。&lt;/p&gt;
&lt;p&gt;代码如下：&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; argparseimport mmapimport osimport reimport subprocessfrom torch.utils.cpp_extension &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; CUDA_HOMEdef&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; run_cuobjdump(file_path):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    command &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;CUDA_HOME&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;bin&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;cuobjdump&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;, &apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;sass&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;, file_path]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    result = subprocess.run(command, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;stdout&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;subprocess.&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;PIPE&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;stderr&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;subprocess.&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;PIPE&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;text&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;True&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    assert&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; result.returncode &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; result.stdoutdef extract_ffma(sass):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    lines = sass.splitlines()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    collected = []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    current = []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    arch_name, func_name = &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;N/A&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;N/A&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    skip_next_line = &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;False&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; line &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; lines:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; &apos;code for&apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; line:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            arch_name = line.lstrip().lstrip(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;code for &apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;).rstrip()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        elif&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; &apos;Function :&apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; line:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            func_name = line.lstrip().lstrip(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;Function :&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;).rstrip()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        elif&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; &apos;FFMA&apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; line:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            current.append(line)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            skip_next_line = &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;True&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        elif&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; skip_next_line:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            current.append(line)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            skip_next_line = &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;False&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        else&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;            if&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(current) &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;                assert&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(current) &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;                collected.append((&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;arch_name}::{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;func_name}&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;, current))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            current = []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; os.getenv(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;DG_PRINT_REG_REUSE&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;None&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;        print&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;Found &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(collected)} &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;FFMA&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; segments&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; collecteddef extract_hex_from_line(line):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    match&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; re.search(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;r&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;/&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;\s&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;0x&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;0-9a-fA-F&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;)\s&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\*&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;/&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, line)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    assert&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; match&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; int&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(match.group(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;), &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; validate(m, offset, le_bytes, num_lines):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    assert&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(le_bytes) &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; num_lines &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    assert&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; m[offset:offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; le_bytes[&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; range&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, num_lines &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; m[offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; le_bytes[i]:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;            return&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; False&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; Truedef parse_registers(line):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    import&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; re&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    line&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; re.sub(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;r&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;/&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*?&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\*&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;/&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, line)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    line&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; line.replace(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;;&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    tokens&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; line.strip().split(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;,&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    registers&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; token &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; tokens:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;        token&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; token.strip()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;        words&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; token.split()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; word &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; words:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;            if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; word.startswith(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;R&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;                reg&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; word.split(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;.&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)[&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;                registers.append(reg)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; registersdef modify_segment(m, name, ffma_lines):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    num_lines&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(ffma_lines)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    assert&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; num_lines &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    le_bytes, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;new_le_bytes&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; [], []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    reused_list&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    dst_reg_set&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; set&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    last_reused, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;last_dst_reg&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; False&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    num_changed&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; range&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(num_lines &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;        dst_reg&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; parse_registers(ffma_lines[i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;])[&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        low_line, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;high_line&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; ffma_lines[i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;], ffma_lines[i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        low_hex, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;high_hex&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; extract_hex_from_line(low_line), extract_hex_from_line(high_line)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        le_bytes.append(low_hex.to_bytes(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;little&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; high_hex.to_bytes(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;little&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;        reused&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; (high_hex &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; 0x&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0800000000000000&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; reused:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;            is_first_occurred&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; dst_reg &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;not&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; dst_reg_set&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;            if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; is_first_occurred &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; (last_reused &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; dst_reg &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; last_dst_reg):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;                # Modify the `reuse` and `yield` bits&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;                assert&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; high_hex &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; 0x&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0800200000000000&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;hex&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(high_hex)}&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;                high_hex &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;^=&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; 0x&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0800200000000000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;                reused&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; False&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;                num_changed &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;            else&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;                reused_list.append(i)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        dst_reg_set.add(dst_reg)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        new_le_bytes.append(low_hex.to_bytes(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;little&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; high_hex.to_bytes(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;little&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        last_reused, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;last_dst_reg&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; reused, dst_reg&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; os.getenv(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;DG_PRINT_REG_REUSE&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;None&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;        print&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&quot; &gt; segment `&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;name}&lt;/span&gt;&lt;span style=&quot;color:#FF938A;font-style:italic&quot;&gt;` new reused &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF;font-style:italic&quot;&gt;list&lt;/span&gt;&lt;span style=&quot;color:#FF938A;font-style:italic&quot;&gt; ({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#FF938A;font-style:italic&quot;&gt;num_changed} changed): {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#FF938A;font-style:italic&quot;&gt;reused_list}&lt;/span&gt;&lt;span style=&quot;color:#96D0FF;font-style:italic&quot;&gt;&quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390;font-style:italic&quot;&gt;    # Find the offset&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    offsets&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    offset&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; m.find(le_bytes[&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    while&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        offsets.append(offset)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;        offset&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; m.find(le_bytes[&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;], offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    offsets&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;filter&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;lambda&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; x: validate(m, x, le_bytes, num_lines), offsets))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # Replace with `new_le_bytes`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; offsets:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; range&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(num_lines &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 2&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            m[offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:offset &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; 16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; new_le_bytes[i]&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; process(path):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; os.getenv(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;DG_PRINT_REG_REUSE&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;None&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;        print&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;Processing &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;path}&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    output&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; run_cuobjdump(path)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    segments&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; extract_ffma(output)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    with&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; open&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(path, &lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;r+b&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; f:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;        mm&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; mmap.mmap(f.fileno(), &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;access&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;mmap.&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;ACCESS_WRITE&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;        for&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; segment &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; segments:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;            modify_segment(mm, &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;segment)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;        mm.close()&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; __name__&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; &quot;__main__&quot;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    parser&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; argparse.ArgumentParser(&lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;Interleave FFMA reg reuse&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    parser.add_argument(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;--so&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;help&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;Path to the SO file&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;    args&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; parser.parse_args()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    process(args.so)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这个文件主要用于优化CUDA编译后的汇编代码中的FFMA(Fused Floating-point Multiply-Add)指令的寄存器重用模式。主要目的是通过修改二进制文件来改善GPU指令的执行效率。&lt;/p&gt;
&lt;p&gt;主要函数功能：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SASS代码提取&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; run_cuobjdump&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(file_path):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 使用CUDA工具cuobjdump来提取SASS（汇编）代码&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    command &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;CUDA_HOME&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;bin&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;cuobjdump&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;, &apos;&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;sass&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;, file_path]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;FFMA指令分析&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; extract_ffma&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(sass):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 从SASS代码中提取包含FFMA指令的代码段&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 收集架构名称、函数名称和相关FFMA指令序列&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;寄存器使用分析&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; parse_registers&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(line):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 解析指令中使用的寄存器&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 提取以&apos;R&apos;开头的寄存器标识符&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;二进制修改&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; modify_segment&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(m, name, ffma_lines):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 修改FFMA指令的重用位和yield位&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#768390&quot;&gt;    # 通过修改特定位模式(0x0800200000000000)来优化寄存器重用&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;工作流程&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;首先读取编译后的CUDA共享库(.so文件)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用cuobjdump工具提取SASS代码&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;识别并收集所有FFMA指令序列&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;分析每个FFMA指令的寄存器使用模式&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;根据特定规则修改寄存器重用标志&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;将修改后的指令写回原文件&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;优化策略&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;该工具主要针对以下情况进行优化：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;当寄存器首次使用时&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;当连续重用相同目标寄存器时&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;通过修改重用(reuse)和yield位来优化指令调度&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;使用方式&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;python interleave_ffma.py --so path/to/cuda_lib.so&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;分析&lt;/p&gt;
&lt;p&gt;这个工具是一个后处理优化器，它在CUDA代码编译后运行，通过修改生成的二进制文件来优化GPU指令的执行效率。主要关注点是FFMA指令的寄存器重用模式，这对于深度学习等计算密集型应用的性能有重要影响。&lt;/p&gt;
&lt;p&gt;文件里面有个正则很多人看不懂&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color:#DCBDFB&quot;&gt; extract_hex_from_line&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(line):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;    match &lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; re.search(&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;r&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;&apos;/&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;0x&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;0-9a-fA-F&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#8DDB8C;font-weight:bold&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#F47067&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt;/&apos;&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;, line)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    assert&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt; match&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F47067&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; int&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;(match.group(&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;), &lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;16&lt;/span&gt;&lt;span style=&quot;color:#ADBAC7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;其实是在CUDA SASS汇编代码中，指令通常以这种格式出现：&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;FFMA R8, R8, R6, R4;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;                  /* 0x5c98078000870808 */&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这个正则表达式会从上面的代码中提取出 0x5c98078000870808，这个十六进制数代表了实际的机器指令编码。&lt;/p&gt;
&lt;p&gt;这个函数：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;从汇编代码行中提取十六进制指令编码&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用match.group(1)获取第一个捕获组（即十六进制数）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;将其转换为整数用于后续的指令修改&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这是整个工具中重要的一步，因为它需要这些指令编码来：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;定位需要修改的指令&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改指令中的特定位（如重用标志和yield位）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;将修改后的指令写回文件&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;只能感叹，deepseek工程师比一般的英伟达员工更懂CUDA！你看，他们API又降价了。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/6078ef5ebd6ca42f.png&quot; alt=&quot;只能感叹，deepseek工程师比一般的英伟达员工更懂CUDA！你看，他们API&quot;&gt;&lt;/p&gt;
&lt;p&gt;关注我，明天继续带来深度分析，我们一起猛学。&lt;/p&gt;
&lt;p&gt;往期文章：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126526&amp;#x26;idx=1&amp;#x26;sn=a65f1ebcd609553daf057a11423996f3&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第二天：DeepEP深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126513&amp;#x26;idx=1&amp;#x26;sn=325c82d7c75a8ceb3f7bcfd63280d72e&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第一天：FlashMLA 深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126493&amp;#x26;idx=1&amp;#x26;sn=e0082b3ac23090cf9a363209f887c4e4&amp;#x26;scene=21#wechat_redirect&quot;&gt;开源周来袭：DeepSeek有哪些神秘技术即将公开？&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;参考链接：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2401.02954&quot;&gt;https://arxiv.org/abs/2401.02954&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/DeepGEMM&quot;&gt;https://github.com/deepseek-ai/DeepGEMM&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2408.14158&quot;&gt;https://arxiv.org/abs/2408.14158&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2412.19437&quot;&gt;https://arxiv.org/abs/2412.19437&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>AI Research</category><category>deepseek</category><category>开源</category><category>ai</category></item><item><title>DeepSeek开源周第二天：DeepEP深度分析</title><link>https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%BA%8C%E5%A4%A9deepep%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%BA%8C%E5%A4%A9deepep%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</guid><description>带你深入分析DeepSeek DeepEP</description><pubDate>Tue, 25 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;开源周第二天，deepseek官方X 在10:24分发了一个文，带来了开源周的第二个开源项目DeepEP。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/4022fbb9ca83e91b.png&quot; alt=&quot;开源周第二天，deepseek官方X 在10:24分发了一个文，带来了开源周的第&quot;&gt;&lt;/p&gt;
&lt;p&gt;deepseek X文介绍说：&lt;/p&gt;
&lt;p&gt;DeepEP —— 第一个用于 MoE 训练和推理的开源 EP 通信库。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;✅ 高效且优化的全互联（all-to-all）通信&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 支持节点内和节点间通信，兼容 NVLink 和 RDMA&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 面向训练和推理预填充的高吞吐量内核&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 面向推理解码的低延迟内核&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 原生支持 FP8 数据类型分发&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;✅ 灵活的 GPU 资源控制，实现计算与通信的重叠&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/a678719606959228.png&quot; alt=&quot;✅ 灵活的 GPU 资源控制，实现计算与通信的重叠&quot;&gt;&lt;/p&gt;
&lt;p&gt;代码发布之后，目前已经4.3K Star。&lt;/p&gt;
&lt;p&gt;很多人对MoE模型不是很熟悉，本文先简单介绍一个MoE和deepseek 在MoE上的一些工作。&lt;/p&gt;
&lt;h2 id=&quot;&quot;&gt;&lt;/h2&gt;
&lt;h2 id=&quot;moe介绍&quot;&gt;MoE介绍&lt;/h2&gt;
&lt;h2 id=&quot;-1&quot;&gt;&lt;/h2&gt;
&lt;p&gt;专家混合模型（Mixture-of-Experts，简称 MoE）是 transformer架构的一种简单扩展，它正迅速成为中到大型语言模型（20亿到6000亿参数）的首选架构。&lt;/p&gt;
&lt;p&gt;主要优点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;与稠密模型相比， &lt;strong&gt;预训练速度更快&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;与具有相同参数数量的模型相比，具有更快的&lt;strong&gt;推理速度&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;存在的问题：需要&lt;strong&gt;大量内存&lt;/strong&gt;，因为所有专家系统都需要加载到内存中，并且通常用于中到大型模型，所以往往需要在多个 GPU 上并行处理，而且通信必须非常高效。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/f6a3d4b214c8aa0a.png&quot; alt=&quot;存在的问题：需要 大量内存 ，因为所有专家系统都需要加载到内存中，并且通常用于中&quot;&gt;&lt;/p&gt;
&lt;p&gt;MoE模型主要由两个关键部分组成:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;稀疏 MoE 层&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这些层代替了传统 Transformer 模型中的前馈网络 (FFN) 层。MoE 层包含若干“专家”(例如 8 个)，每个专家本身是一个独立的神经网络。&lt;/p&gt;
&lt;p&gt;2.&lt;strong&gt;门控网络或路由&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;这个部分用于决定哪些令牌 (token) 被发送到哪个专家。有时，一个令牌甚至可以被发送到多个专家。&lt;/p&gt;
&lt;p&gt;总结：混合专家模型 (MoE) 的一个显著优势是它们能够在远少于稠密模型所需的计算资源下进行有效的预训练。这意味着在相同的计算预算条件下，你可以显著扩大模型或数据集的规模。特别是在预训练阶段，与稠密模型相比，混合专家模型通常能够更快地达到相同的质量水平。&lt;/p&gt;
&lt;h2 id=&quot;deepseek-moe&quot;&gt;DeepSeek MoE&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/039b7bc2ce205d62.png&quot; alt=&quot;DeepSeek MoE&quot;&gt;&lt;/p&gt;
&lt;p&gt;deepseek在2024年1月11日发布了DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models 论文，算是非常早研究MoE模型的公司。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/ad875968aaebce56.png&quot; alt=&quot;deepseek在2024年1月11日发布了DeepSeekMoE: Towar&quot;&gt;&lt;/p&gt;
&lt;p&gt;在DeepSeekMoE论文中，主要提出了Router Expert 和Shared Expert概念，并且实验了增加细粒度专家的效果。&lt;/p&gt;
&lt;p&gt;论文中，DeepSeekMoE 16B拥有每层包含2个共享专家和64个路由专家，每个token激活2个共享专家和6个路由专家，而145B版本则有4个共享专家和128个路由专家，每个token激活4个共享专家和12个路由专家。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/3ae957d578b9a847.png&quot; alt=&quot;论文中，DeepSeekMoE 16B拥有每层包含2个共享专家和64个路由专家&quot;&gt;&lt;/p&gt;
&lt;p&gt;在DeepSeekMoE论文中也提到了今天要讲的主题：Expert Parallelism(专家并行)&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/1a705462fabdcb7b.png&quot; alt=&quot;在DeepSeekMoE论文中也提到了今天要讲的主题：Expert Parall&quot;&gt;&lt;/p&gt;
&lt;p&gt;在DeepSeek V3论文中，则有两段文字描述，给出了更详细的数据。DeepSeek R1 是基于V3来训练的，虽然没有提到更多的信息，基本上也与V3保持一致。&lt;/p&gt;
&lt;h2 id=&quot;deepep介绍&quot;&gt;DeepEP介绍&lt;/h2&gt;
&lt;h2 id=&quot;-2&quot;&gt;&lt;/h2&gt;
&lt;p&gt;DeepEP 是一个MoE模型和专家并行（Expert Parallelism, EP）设计的通信库。它提供了高吞吐量和低延迟的全互联 GPU 内核，这些内核也被称为 MoE 数据分发（dispatch）和合并（combine）。此外，该库还支持低精度操作，包括 FP8。&lt;/p&gt;
&lt;p&gt;为了与 &lt;strong&gt;DeepSeek-V3&lt;/strong&gt; 论文中提出的分组限制门控算法（group-limited gating algorithm）相匹配，DeepEP 提供了一组针对非对称域带宽转发优化的内核，例如从 NVLink 域向 RDMA 域转发数据。这些内核具有高吞吐量，非常适合用于训练和推理预填充任务。此外，它们还支持流式多处理器（Streaming Multiprocessors, SM）数量控制。&lt;/p&gt;
&lt;p&gt;针对对延迟敏感的推理解码任务，DeepEP 包含了一组使用纯 RDMA 的低延迟内核，以最大限度地减少延迟。该库还引入了一种基于钩子（hook）的通信与计算重叠方法，不占用任何 SM 资源。&lt;/p&gt;
&lt;p&gt;注意：该库的实现可能与 &lt;strong&gt;DeepSeek-V3&lt;/strong&gt; 论文存在一些细微差异。&lt;/p&gt;
&lt;h2 id=&quot;性能&quot;&gt;性能&lt;/h2&gt;
&lt;h2 id=&quot;-3&quot;&gt;&lt;/h2&gt;
&lt;h3 id=&quot;普通内核的-nvlink-和-rdma-转发测试&quot;&gt;普通内核的 NVLink 和 RDMA 转发测试&lt;/h3&gt;
&lt;h3 id=&quot;-4&quot;&gt;&lt;/h3&gt;
&lt;p&gt;我们在 H800 上测试了普通内核（NVLink 最大带宽约为 160 GB/s），每个设备连接到一张 CX7 InfiniBand 400 Gb/s 的 RDMA 网卡（最大带宽约为 50 GB/s）。测试遵循 &lt;strong&gt;DeepSeek-V3/R1&lt;/strong&gt; 的预训练设置：每批次 4096 个 token，隐藏层维度为 7168，top-4 分组，top-8 专家，FP8 分发与 BF16 合并。&lt;/p&gt;
&lt;p&gt;类型&lt;/p&gt;
&lt;p&gt;Dispatch #EP&lt;/p&gt;
&lt;p&gt;瓶颈带宽&lt;/p&gt;
&lt;p&gt;Combine #EP&lt;/p&gt;
&lt;p&gt;瓶颈带宽&lt;/p&gt;
&lt;p&gt;节点内&lt;/p&gt;
&lt;p&gt;8&lt;/p&gt;
&lt;p&gt;153 GB/s (NVLink)&lt;/p&gt;
&lt;p&gt;8&lt;/p&gt;
&lt;p&gt;158 GB/s (NVLink)&lt;/p&gt;
&lt;p&gt;节点间&lt;/p&gt;
&lt;p&gt;16&lt;/p&gt;
&lt;p&gt;43 GB/s (RDMA)&lt;/p&gt;
&lt;p&gt;16&lt;/p&gt;
&lt;p&gt;43 GB/s (RDMA)&lt;/p&gt;
&lt;p&gt;节点间&lt;/p&gt;
&lt;p&gt;32&lt;/p&gt;
&lt;p&gt;44 GB/s (RDMA)&lt;/p&gt;
&lt;p&gt;32&lt;/p&gt;
&lt;p&gt;47 GB/s (RDMA)&lt;/p&gt;
&lt;p&gt;节点间&lt;/p&gt;
&lt;p&gt;64&lt;/p&gt;
&lt;p&gt;46 GB/s (RDMA)&lt;/p&gt;
&lt;p&gt;64&lt;/p&gt;
&lt;p&gt;45 GB/s (RDMA)&lt;/p&gt;
&lt;h3 id=&quot;-5&quot;&gt;&lt;/h3&gt;
&lt;h3 id=&quot;纯-rdma-的低延迟内核测试&quot;&gt;纯 RDMA 的低延迟内核测试&lt;/h3&gt;
&lt;h3 id=&quot;-6&quot;&gt;&lt;/h3&gt;
&lt;p&gt;我们在 H800 上测试了低延迟内核，每个设备连接到一张 CX7 InfiniBand 400 Gb/s 的 RDMA 网卡（最大带宽约为 50 GB/s）。测试遵循典型的 &lt;strong&gt;DeepSeek-V3/R1&lt;/strong&gt; 生产环境设置：每批次 128 个 token，隐藏层维度为 7168，top-8 专家，FP8 分发与 BF16 合并。&lt;/p&gt;
&lt;p&gt;Dispatch #EP&lt;/p&gt;
&lt;p&gt;延迟 (Latency)&lt;/p&gt;
&lt;p&gt;RDMA 带宽&lt;/p&gt;
&lt;p&gt;Combine #EP&lt;/p&gt;
&lt;p&gt;延迟 (Latency)&lt;/p&gt;
&lt;p&gt;RDMA 带宽&lt;/p&gt;
&lt;p&gt;8&lt;/p&gt;
&lt;p&gt;163 us&lt;/p&gt;
&lt;p&gt;46 GB/s&lt;/p&gt;
&lt;p&gt;8&lt;/p&gt;
&lt;p&gt;318 us&lt;/p&gt;
&lt;p&gt;46 GB/s&lt;/p&gt;
&lt;p&gt;16&lt;/p&gt;
&lt;p&gt;173 us&lt;/p&gt;
&lt;p&gt;43 GB/s&lt;/p&gt;
&lt;p&gt;16&lt;/p&gt;
&lt;p&gt;329 us&lt;/p&gt;
&lt;p&gt;44 GB/s&lt;/p&gt;
&lt;p&gt;32&lt;/p&gt;
&lt;p&gt;182 us&lt;/p&gt;
&lt;p&gt;41 GB/s&lt;/p&gt;
&lt;p&gt;32&lt;/p&gt;
&lt;p&gt;350 us&lt;/p&gt;
&lt;p&gt;41 GB/s&lt;/p&gt;
&lt;p&gt;64&lt;/p&gt;
&lt;p&gt;186 us&lt;/p&gt;
&lt;p&gt;40 GB/s&lt;/p&gt;
&lt;p&gt;64&lt;/p&gt;
&lt;p&gt;353 us&lt;/p&gt;
&lt;p&gt;41 GB/s&lt;/p&gt;
&lt;p&gt;128&lt;/p&gt;
&lt;p&gt;192 us&lt;/p&gt;
&lt;p&gt;39 GB/s&lt;/p&gt;
&lt;p&gt;128&lt;/p&gt;
&lt;p&gt;369 us&lt;/p&gt;
&lt;p&gt;39 GB/s&lt;/p&gt;
&lt;p&gt;256&lt;/p&gt;
&lt;p&gt;194 us&lt;/p&gt;
&lt;p&gt;39 GB/s&lt;/p&gt;
&lt;p&gt;256&lt;/p&gt;
&lt;p&gt;360 us&lt;/p&gt;
&lt;p&gt;40 GB/s&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;代码解读&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;优化思路中最重要的还是低延迟通信优化这里主要提一下其他的比如动态调度和异步通信流管理可以去看相关的文档和代码&quot;&gt;优化思路中，最重要的还是低延迟通信优化，这里主要提一下。其他的比如动态调度和异步通信，流管理可以去看相关的文档和代码。&lt;/h3&gt;
&lt;h3 id=&quot;-7&quot;&gt;&lt;/h3&gt;
&lt;h3 id=&quot;-8&quot;&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;双缓冲区&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;auto buffer = layout.buffers[low_latency_buffer_idx];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;   auto next_buffer = layout.buffers[low_latency_buffer_idx ^= 1];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;交替使用两个缓冲区，一个用于当前操作，另一个用于下一次操作&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;通过位运算^= 1高效切换缓冲区索引&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;TMA (Tensor Memory Access) 优化&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;利用Hopper架构的TMA指令加速数据传输&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;支持FP8等低精度数据格式，减少通信带宽需求&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;IBGDA直接通信&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// Initialize recv queues for low-latency mode ARibgda_initialize_recv_queue&gt;&gt;(rank);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;使用NVSHMEM的IBGDA技术实现GPU直接处理RDMA通信&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;完全绕过CPU参与，降低延迟&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;专家级QP分配&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;_buffer = Buffer(group, 0, num_rdma_bytes, low_latency_mode=True,num_qps_per_rank=num_experts // group.size())&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;为每个本地专家分配独立的QP，消除资源竞争&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;deepep适用场景&quot;&gt;DeepEP适用场景：&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;大规模MoE模型训练（如千亿参数级别）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;高并发低延迟的实时推理服务&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;多模态、科学计算等异构计算任务&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;特别的，在repo最后，deepseek还说明，用了一个没有在英伟达文档里面的指令用来做优化，真是拥有探索精神的黑客，值得学习！&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/18f197426423eb9c.png&quot; alt=&quot;特别的，在repo最后，deepseek还说明，用了一个没有在英伟达文档里面的指&quot;&gt;&lt;/p&gt;
&lt;p&gt;往期文章：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126513&amp;#x26;idx=1&amp;#x26;sn=325c82d7c75a8ceb3f7bcfd63280d72e&amp;#x26;scene=21#wechat_redirect&quot;&gt;DeepSeek开源周第一天：FlashMLA 深度分析&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126493&amp;#x26;idx=1&amp;#x26;sn=e0082b3ac23090cf9a363209f887c4e4&amp;#x26;scene=21#wechat_redirect&quot;&gt;开源周来袭：DeepSeek有哪些神秘技术即将公开？&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;参考链接：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/DeepEP&quot;&gt;https://github.com/deepseek-ai/DeepEP&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/2401.06066&quot;&gt;https://arxiv.org/pdf/2401.06066&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/deepseek-ai/DeepSeek-MoE&quot;&gt;https://github.com/deepseek-ai/DeepSeek-MoE&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>AI Research</category><category>deepseek</category><category>开源</category><category>ai</category></item><item><title>DeepSeek开源周第一天：FlashMLA 深度分析</title><link>https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%B8%80%E5%A4%A9flashmla-%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/deepseek%E5%BC%80%E6%BA%90%E5%91%A8%E7%AC%AC%E4%B8%80%E5%A4%A9flashmla-%E6%B7%B1%E5%BA%A6%E5%88%86%E6%9E%90/</guid><description>DeepSeek FlashMLA 深度分析</description><pubDate>Mon, 24 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/dfb17a0adb64cc3c.png&quot; alt=&quot;今天早上9点34，deepseek在X上发布了开源周第一天的项目FlashMLA&quot;&gt;&lt;/p&gt;
&lt;p&gt;今天早上9点34，deepseek在X上发布了开源周第一天的项目FlashMLA，这篇就带来FlashMLA的深度分析。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/49b06a43fdc46266.png&quot; alt=&quot;今天早上9点34，deepseek在X上发布了开源周第一天的项目FlashMLA&quot;&gt;&lt;/p&gt;
&lt;p&gt;FlashMLA项目非常受欢迎，目前代码已经有6.8k Star&lt;/p&gt;
&lt;p&gt;简单介绍MLA&lt;/p&gt;
&lt;p&gt;MLA(Multi-Head  Latent Attention) 是deepseek 在论文 &lt;strong&gt;DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model&lt;/strong&gt;  中提出来的针对多头注意力(Multi-Head Attention, MHA)的优化方法。&lt;/p&gt;
&lt;p&gt;在Transformer模型中，MHA是最消耗算力的模块之一，如果想要大规模场景下保持高效率，就需要进一步优化。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/9d17fadd7283a00d.png&quot; alt=&quot;在Transformer模型中，MHA是最消耗算力的模块之一，如果想要大规模场景&quot;&gt;&lt;/p&gt;
&lt;p&gt;MLA算是MHA的一个变种，在实现上继承了FlashAttention的一些东西，DeepSeek-V2论文中主要是对比MHA，GQA，MQA，优化效果如下图：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/bdbc02a4fb9ff7b0.png&quot; alt=&quot;MLA算是MHA的一个变种，在实现上继承了FlashAttention的一些东西&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/04073aa21cf090c6.png&quot; alt=&quot;MLA算是MHA的一个变种，在实现上继承了FlashAttention的一些东西&quot;&gt;&lt;/p&gt;
&lt;p&gt;在一些推理框架中，也实现了MLA。如下图所示，SGLang加入 MLA之后，吞吐量有2-3倍的增加。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/f7568afcdf9ab169.png&quot; alt=&quot;在一些推理框架中，也实现了MLA。如下图所示，SGLang加入 MLA之后，吞吐&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;&quot;&gt;&lt;/h2&gt;
&lt;h2 id=&quot;flashmla-使用&quot;&gt;FlashMLA 使用&lt;/h2&gt;
&lt;h2 id=&quot;-1&quot;&gt;&lt;/h2&gt;
&lt;p&gt;环境要求是：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Hopper GPUs&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;最低CUDA 12.3&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;最低 PyTorch 2.0&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;安装：&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; clone&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; https://github.com/deepseek-ai/FlashMLA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;python&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; setup.py&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; install&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;使用方法：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/08f2b765affa42a6.png&quot; alt=&quot;使用方法&quot;&gt;&lt;/p&gt;
&lt;p&gt;性能：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;仓库提供了Benchmark文件可以直接跑。官方列出&lt;/strong&gt;在 H800 SXM5 上，使用 CUDA 12.6，在内存限制配置下实现高达 3000 GB/s 的速度，在计算限制配置下实现 580 TFLOPS 的性能。&lt;/p&gt;
&lt;h2 id=&quot;代码分析&quot;&gt;代码分析&lt;/h2&gt;
&lt;h2 id=&quot;-2&quot;&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/7961a9d43163b872.png&quot; alt=&quot;代码分析&quot;&gt;&lt;/p&gt;
&lt;p&gt;FlashMLA的代码不多，依赖也很少。&lt;/p&gt;
&lt;p&gt;主要的优化手段如下：&lt;/p&gt;
&lt;p&gt;计算分块和调度优化&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;templatestruct Flash_fwd_kernel_traits_mla {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    // 固定 block 大小为 64x64&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    static constexpr int kBlockM = kBlockM_;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        static constexpr int kBlockN = kBlockN_;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;            // 每个 block 使用 8 个 warp 并行&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    static constexpr int kNWarps = kNWarps_;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        static constexpr int kNThreads = kNWarps * 32;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        // 共享内存优化&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    static constexpr int kBlockKSmem = kHeadDim % 64 == 0 ? 64 : 32;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;关键点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;通过分块(块大小64)分页KV缓存和多warp并行提高计算效率&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;内存访问优化&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;struct Flash_fwd_mla_params {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    using index_t = int64_t;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int b, seqlen_q, d, d_v;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int h, h_h_k_ratio, ngroups;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    bool is_causal;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    float scale_softmax, scale_softmax_log2;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int *__restrict__ cu_seqlens_k;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    void *__restrict__ q_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    void *__restrict__ k_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    void *__restrict__ v_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    void *__restrict__ o_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    void *__restrict__ softmax_lse_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t q_batch_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t k_batch_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t v_batch_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t o_batch_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t q_row_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t k_row_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t v_row_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t o_row_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t q_head_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t k_head_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t v_head_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t o_head_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int *__restrict__ block_table;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    index_t block_table_batch_stride;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int page_block_size;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int *__restrict__ tile_scheduler_metadata_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int num_sm_parts;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    int *__restrict__ num_splits_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    void *__restrict__ softmax_lseaccum_ptr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    void *__restrict__ oaccum_ptr;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;关键点:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;使用分页 KV 缓存(block_table, page_block_size)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;优化的内存布局和访问步长(stride)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 tile_scheduler_metadata 进行调度&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Softmax 计算优化&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;for (int mi = 0; mi (tensor); ++mi) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    MaxOp max_op;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    max(mi) = zero_init ? tensor(mi, 0) : max_op(max(mi), tensor(mi, 0));&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    #pragma unroll&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    for (int ni = 1; ni (tensor); ni++) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        max(mi) = max_op(max(mi), tensor(mi, ni));&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    max(mi) = Allreduce::run(max(mi), max_op);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    // If max is -inf, then all elements must have been -inf (possibly due to masking).&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    // We don&apos;t want (-inf - (-inf)) since that would give NaN.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    const float max_scaled = max(mi) == -INFINITY ? 0.f : max(mi) * scale;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    sum(mi) = 0;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    #pragma unroll&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    for (int ni = 0; ni (tensor); ++ni)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        // Instead of computing exp(x - max), we compute exp2(x * log_2(e) -&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        // max * log_2(e)) This allows the compiler to use the ffma&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        // instruction instead of fadd and fmul separately.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        tensor(mi, ni) = exp2f(tensor(mi, ni) * scale - max_scaled);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        sum(mi) += tensor(mi, ni);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    SumOp sum_op;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    sum(mi) = Allreduce::run(sum(mi), sum_op);}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;关键点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;使用 log2/exp2 替代 log/exp&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 FFMA 指令优化&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;通过 warp-level 规约优化求和&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;双缓冲优化&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;struct SharedStorageMLA {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    union {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        struct {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;            // 双缓冲 K 矩阵&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;            cute::array_aligned&gt; smem_q;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;            cute::array_aligned * 2&gt; smem_k;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  // Double buffer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;            cute::array_aligned&gt; smem_p;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;            cute::array_aligned&gt; smem_scale;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    };};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;关键点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;通过双缓冲隐藏内存延迟，提高硬件利用率&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;FlashMLA总的来说是算是定制版的flash attention，目前适用场景：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;环境需要是&lt;strong&gt;CUDA 11+&lt;/strong&gt;、&lt;strong&gt;SM90+&lt;/strong&gt; Hopper架构&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;需要对 &lt;strong&gt;BF16&lt;/strong&gt;（Q=576, V=512）的多头注意力做推理或训练&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;对大序列场景，需结合 split-K 方案提升吞吐&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;昨天我猜的推理优化，应该算猜对？我们来复习下：&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126493&amp;#x26;idx=1&amp;#x26;sn=e0082b3ac23090cf9a363209f887c4e4&amp;#x26;scene=21#wechat_redirect&quot;&gt;开源周来袭：DeepSeek有哪些神秘技术即将公开？&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/d68839e1b211b899.png&quot; alt=&quot;昨天我猜的推理优化，应该算猜对？我们来复习下：开源周来袭：DeepSeek有哪些&quot;&gt;&lt;/p&gt;
&lt;p&gt;如上图，目前官方优化的方法还有不少，期待明天的项目，感觉还是infra，难度会是MTP?  关注我，我们一起猛学。&lt;/p&gt;
&lt;p&gt;链接：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;FlashMLA   &lt;a href=&quot;https://github.com/deepseek-ai/FlashMLA&quot;&gt;https://github.com/deepseek-ai/FlashMLA&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model   &lt;a href=&quot;https://arxiv.org/abs/2405.04434&quot;&gt;https://arxiv.org/abs/2405.04434&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;sglang-v0-3 &lt;a href=&quot;https://lmsys.org/blog/2024-09-04-sglang-v0-3/&quot;&gt;https://lmsys.org/blog/2024-09-04-sglang-v0-3/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>AI Research</category><category>deepseek</category><category>开源</category><category>大模型</category></item><item><title>【读书笔记】憨夺型投资者</title><link>https://pxiaoer.blog/posts/2025/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0%E6%86%A8%E5%A4%BA%E5%9E%8B%E6%8A%95%E8%B5%84%E8%80%85/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2025/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0%E6%86%A8%E5%A4%BA%E5%9E%8B%E6%8A%95%E8%B5%84%E8%80%85/</guid><description>憨夺其实是一个印度词的翻译，dhandho。</description><pubDate>Thu, 06 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2025/02/wx20250205-235033402x.png&quot; alt=&quot;什么是憨夺型投资者&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;什么是憨夺型投资者&quot;&gt;什么是憨夺型投资者&lt;/h2&gt;
&lt;p&gt;憨夺其实是一个印度词的翻译，dhandho。&lt;/p&gt;
&lt;p&gt;dhandho 是印度古吉拉特邦的一个词，源自于梵语中的财富，字面意思是指努力创造财富。&lt;/p&gt;
&lt;p&gt;憨夺解释就是：无风险的方法保证财富的创造。&lt;/p&gt;
&lt;h2 id=&quot;憨夺型投资者的原则&quot;&gt;憨夺型投资者的原则&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;101： 投资现有的业务&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;102： 投资经营模式简单的企业&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;201： 投资低迷行业里遭遇困境的企业&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;202： 投资具有持久竞争优势的行业&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;301： 少投注，投大注，只挑最好的投&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;302： 注重套利&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;401： 安全边际的重要性&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;402： 投资风险低，不确定性高的业务&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;403： 投资中模仿好过创新&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>读书笔记</category><category>读书笔记</category></item><item><title>AIGC Newsletter 黑五特惠：全年最低价！</title><link>https://pxiaoer.blog/posts/2024/aigc-newsletter-update/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/aigc-newsletter-update/</guid><description>🎯 限时特惠：全年最佳订阅机会！</description><pubDate>Thu, 28 Nov 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;🎯 &lt;strong&gt;限时特惠：全年最佳订阅机会！&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;亲爱的AIGC Newsletter读者们：&lt;/p&gt;
&lt;p&gt;激动人心的消息！我们隆重推出 &lt;strong&gt;黑五特惠活动&lt;/strong&gt;，为您带来&lt;strong&gt;2024年度最低价&lt;/strong&gt; 的订阅优惠！这是升级到完整会员、解锁全部优质内容的绝佳机会。&lt;/p&gt;
&lt;h3 id=&quot;内容升级与全新功能&quot;&gt;内容升级与全新功能&lt;/h3&gt;
&lt;p&gt;我们不断创新，为您提供更高质量的服务与更丰富的内容。以下是订阅后可解锁的核心模块：&lt;/p&gt;
&lt;h4 id=&quot;-aigc-journey&quot;&gt;✨ AIGC Journey&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;每周深度解析AIGC发展趋势&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;实用的指南与教程&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;行业洞察与前沿分析&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;-aigc-weekly&quot;&gt;📊 AIGC Weekly&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;精选每周AI动态与新闻解读&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AI市场趋势与机遇分析&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;优质工具推荐与测评&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;全新栏目形式，内容更深入、更实用&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;-即将推出ai-news-agent&quot;&gt;🔥 即将推出：AI News Agent&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://ainews.kol.tools/&quot;&gt;AINews&lt;/a&gt;迭代版本&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;每日AIGC新闻实时更新&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;个性化新闻筛选功能&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;行业动态一手掌握&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;为什么现在订阅&quot;&gt;为什么现在订阅？&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;黑五专属优惠价格&lt;/strong&gt;：全年最低，仅限本周！&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;解锁所有付费内容&lt;/strong&gt;：获取完整的深度文章。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;抢先体验新功能&lt;/strong&gt;：优先获取后续更新与全新应用测试资格。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;机会稍纵即逝！&lt;/strong&gt; 这是我们全年最大的优惠活动，升级会员，助您在快速发展的AIGC领域始终保持领先。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;👉 &lt;a href=&quot;https://aigc.openbot.ai/subscribe&quot;&gt;立即订阅&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;我们的核心理念&quot;&gt;我们的核心理念&lt;/h3&gt;
&lt;p&gt;自两年前 AIGC Newsletter 创刊以来，我们致力于为读者提供高质量的信息服务。彼时，ChatGPT 尚未问世，但 AIGC 的趋势已初露端倪。为此，我们从海量信息中筛选、整合、提炼，定期以周报形式发送至您的邮箱，让您在最短时间内掌握关键信息。&lt;/p&gt;
&lt;p&gt;需要特别说明的是，&lt;strong&gt;我们并不是在“售卖信息”，而是在“组合信息”。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在信息爆炸的时代，我们的价值在于帮助您梳理复杂内容，提炼清晰趋势，而非简单地传递您可以随处获取的信息。&lt;/p&gt;
&lt;p&gt;您的订阅，更多是一种对服务的认可与支持，而非单纯的信息交易。我们始终相信，信息的价值在于高效整合与独特洞察，而这需要投入大量的时间与精力。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;订阅 &lt;a href=&quot;https://aigc.openbot.ai/&quot;&gt;AIGC Newsletter&lt;/a&gt;，您得到的不只是信息本身，而是时间的节约与趋势的洞察。&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;关于价格与服务&quot;&gt;关于价格与服务&lt;/h3&gt;
&lt;p&gt;我们深知许多人对信息服务的价格有疑虑。&lt;/p&gt;
&lt;p&gt;实际上，信息可以无限复制，但人类的时间却弥足珍贵。为此，我们始终以服务的心态打造信息产品，并以合理的价格为读者提供高附加值的体验。&lt;/p&gt;
&lt;p&gt;随着订阅人数的增长，我们也将进一步优化成本，为更多读者提供更实惠的服务&lt;/p&gt;
&lt;p&gt;如果您认同我们的理念，欢迎向朋友推荐我们的 Newsletter。您的支持与宣传，是我们不断前行的动力。&lt;/p&gt;
&lt;h3 id=&quot;展望未来&quot;&gt;展望未来&lt;/h3&gt;
&lt;p&gt;2024 是一个充满可能性的年份。AIGC Newsletter 的每一次更新，都是在记录并见证这个时代的转折点。从短缺到富足，我们正亲历人类历史的重要时刻，并积极推动这一伟大变革。&lt;/p&gt;
&lt;p&gt;我们相信，富足时代的曙光已现，而您将与我们一同塑造未来。&lt;/p&gt;
&lt;p&gt;感谢您的关注与支持，让我们共同迎接这充满希望的明天！&lt;/p&gt;</content:encoded><category>AIGC Newsletter</category><category>AIGC</category></item><item><title>【读书笔记】随时卖掉你的公司</title><link>https://pxiaoer.blog/posts/2024/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0%E9%9A%8F%E6%97%B6%E5%8D%96%E6%8E%89%E4%BD%A0%E7%9A%84%E5%85%AC%E5%8F%B8/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0%E9%9A%8F%E6%97%B6%E5%8D%96%E6%8E%89%E4%BD%A0%E7%9A%84%E5%85%AC%E5%8F%B8/</guid><description>八个步骤创建离开你也可以独立发展的公司</description><pubDate>Tue, 26 Nov 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2024/11/image.jpg&quot; alt=&quot;八个步骤创建离开你也可以独立发展的公司&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;八个步骤创建离开你也可以独立发展的公司&quot;&gt;八个步骤创建离开你也可以独立发展的公司&lt;/h1&gt;
&lt;h2 id=&quot;第一步找出一种具有发展潜力的产品或服务&quot;&gt;第一步：找出一种具有发展潜力的产品或服务&lt;/h2&gt;
&lt;p&gt;具有发展潜力的业务有三个标准：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;可传授的&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;有价值的&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;可重复的&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2024/11/image-2.png&quot; alt=&quot;可重复的&quot;&gt;&lt;/p&gt;
&lt;p&gt;六种经常性收益的价值顺序:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;合约（比如合约手机）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;自动再生订阅（ 手机存储空间）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;比较昂贵的可再生订阅&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;可再生的订阅（杂志）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;比较昂贵的消费品（剃须刀片）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;消耗品(牙膏）&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;第二步-创造一个良性现金流循环&quot;&gt;第二步 创造一个良性现金流循环&lt;/h2&gt;
&lt;p&gt;经验： 要在支付成本之前，像你的顾客收取全额或者部分费用&lt;/p&gt;
&lt;h2 id=&quot;第三步-聘请一个销售团队&quot;&gt;第三步 聘请一个销售团队&lt;/h2&gt;
&lt;p&gt;经验：包装好产品之后，你需要从销售中抽身&lt;/p&gt;
&lt;p&gt;作为一个企业家，你们的工作是雇佣销售人员来销售你的产品或者服务，这样你就有时间来销售你们的公司了。如果你销售公司产品的时候，你只能挣几百上千美元，但是你把同样的技巧运用到销售公司上，挣的钱就是指数级迅速增长。&lt;/p&gt;
&lt;p&gt;选择销售人员：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;他们必须喜欢销售&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;他们必须喜欢产品&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;至少两名销售&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;第四步-停止销售一切其他的东西&quot;&gt;第四步 停止销售一切其他的东西&lt;/h2&gt;
&lt;p&gt;不要销售那些第一步就落选的产品，虽然这样做增加了收益，但是团队会失去重点，而且顾客意识到你对标准步骤不认真看待，就开始要求量身定做。你为了完成任务，就需要雇佣其他人来做这些工作。&lt;/p&gt;
&lt;p&gt;控制自己不再接受产品或者服务范围外的项目是创造一家没有你也能够独立发展的企业最难的一部分。&lt;/p&gt;
&lt;h2 id=&quot;第五步-为管理人员制定一项长期激励机制&quot;&gt;第五步 为管理人员制定一项长期激励机制&lt;/h2&gt;
&lt;p&gt;为了能够出售企业，你需要向买家证明，你拥有一个管理团队，即使你离开了，他们也能够运营公司，更重要的是你需要向买家证明，收购之后，管理团队愿意留下来。&lt;/p&gt;
&lt;p&gt;你需要订制一个长期的激励计划给你希望留下来的人，每年可以在长期激励账户里面存一笔钱，三年之后才能取三分之一。&lt;/p&gt;
&lt;h2 id=&quot;第六步-找一个经纪人&quot;&gt;第六步 找一个经纪人&lt;/h2&gt;
&lt;p&gt;公司销售低于200万美元，可以找到经纪人，高于这个数，你需要是一个专业的收购公司。&lt;/p&gt;
&lt;p&gt;需要注意，这个经纪人是为你工作的，不能与买方太亲密。&lt;/p&gt;
&lt;h2 id=&quot;第七步--告知你的管理团队&quot;&gt;第七步  告知你的管理团队&lt;/h2&gt;
&lt;p&gt;告诉你的管理团队出售的事，并确保在这次收购中，管理团队有利可图，寻求他们的支持。&lt;/p&gt;
&lt;h2 id=&quot;第八步-把报价转变为一份有约束力的合约&quot;&gt;第八步 把报价转变为一份有约束力的合约&lt;/h2&gt;
&lt;p&gt;意向书并不具备约束力，在渡过尽职调查之后才有约束力的合约，在这期间对方可能会找茬来压低报价。这时候你需要熬过去，如果报价在你的接受范围之内，那就是可以接受这次收购的。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2024/11/image-1.png&quot; alt=&quot;意向书并不具备约束力，在渡过尽职调查之后才有约束力的合约，在这期间对方可能会找茬&quot;&gt;&lt;/p&gt;</content:encoded><category>创业笔记</category><category>读书笔记</category></item><item><title>How to go from 0 to $5M ARR profitably (step by step)</title><link>https://pxiaoer.blog/posts/2024/how-to-go-from-0-to-5m-arr-profitably-step-by-step/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/how-to-go-from-0-to-5m-arr-profitably-step-by-step/</guid><description>这篇是一个学习笔记，原文作者为David Park, 链接</description><pubDate>Sat, 02 Nov 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;这篇是一个学习笔记，原文作者为David Park, 链接： &lt;a href=&quot;https://x.com/Davidjpark96/status/1789773192435060737&quot;&gt;https://x.com/Davidjpark96/status/1789773192435060737&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;David Park是jenni ai的CEO，目前jenniAI的ARR为$8M&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2024/11/image.png&quot; alt=&quot;David Park是jenni ai的CEO，目前jenniAI的ARR为$8&quot;&gt;&lt;/p&gt;
&lt;p&gt;原文：&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;How to go from 0 to $5M ARR profitably (step by step)&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is every growth hack we used for each of our distribution channels:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Organic Short-form content&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Influencer Marketing&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;SEO&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Paid Ads&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Organic Short-form content&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The most important thing to remember in this new age of social media is that follower counts don’t matter at all&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;I would unironically sponsor a fresh account made this week vs a YouTuber with a million subs if they had similar views and I don’t even think it’s a controversial opinion&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;(especially when you consider that the famous YouTuber will charge you potentially 30x more for less results, but I would maybe even choose the new account if they were the same price)&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The reason being that new accounts are highly volatile and if you put out a great engaging piece of content then it could easily go viral regardless of how many followers you have&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;But rather than finding and sponsoring these new accounts in your niche, you can just create these accounts yourself&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;You just need to follow this basic format:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Find a face for your account&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Craft a viral video ‘series’&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Multiply your accounts&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;What would happen if BTS made a new TikTok account and started posting?&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;All videos on the new account would immediately go viral because the algo would push the videos back to their fans&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Despite having zero followers, this new TikTok account will ‘behave’ as though it has hundreds of millions of followers&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;One great hack is to find someone who already has an audience of people that you know will convert, then ask them to create a completely new account to posts videos about your product&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is an amazing hack because creators are usually very open to this idea because it doesn’t dilute their main page, it’ll be way cheaper to pay for 20 videos on a new account every month vs 20 sponsored posts on their main account, and it’ll get way better results&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;For example we found a creator named Mengmengduck whose entire account at the time was teaching students how to write to employers and we paid him $4000 for 20 videos/mo&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;In our first month we got 7 million+ impressions, just as expected the videos on the brand new account were being pushed to the followers on his main account&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;When you get a new creator just follow this basic guideline:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Repost vids on all platforms (Reels, TikTok, YT Shorts)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Post 1+ videos per day&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Initially, post vids similar to what the influencer posts on their main account, then start experimenting with videos that feature your product&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;We paid $4000/mo for MMD who had 500k followers, but you can get someone cheaper for similar results!&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The entire goal when working with your creator is to find a viral “series” because a video that goes viral once will go viral again&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;You want a video that you can basically tweak slightly and repost multiple times a week that is still fun for the audience&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Once you find a viral series, you can start creating new accounts but this time you don’t need to work with big creators, you can just find charismatic UGC creators because you’ve found content that is engaging and poised to go viral&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Currently, we have about 5 different Jenni AI accounts all posting similar content&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Many of our accounts have tens or sometimes just hundreds of followers and they just repost stuff from our main account&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;In some cases, the account with 48 followers gets MORE views than our main account with 55k followers…even when posting identical videos&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Examples of viral series:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;A guy tries to see how many sticks of spaghetti it takes to hold his weight. Then he tries to see how many coat hangers. Then he tries to use sheets of paper. Etc etc. All the same video, minimal effort but will go viral every time.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;A guy drinks a cup of milk for every 1000 followers he has. Everyday it’s the same video where he drinks milk but people continually tune in because they want to see him suffer and drink hundreds of cups of milk. Will go viral every time.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;For us we had “POV you have an essay due” and it was just a ridiculous plot of someone realising they have an essay due while they are taking a shit or right before they sleep or w/e and it always ended with them using Jenni AI to help them write their essay faster. Same video, slightly different 10 second intro each time.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Thinking of new viral video ideas are so hard, so just try to think of tweaking your few winning videos into “series” and just think about prolonging the lifespan of your content&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The order of virality:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Have one account on each platform (TikTok, Instagram, YT shorts) and experiment with a ton of hooks and video ideas&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Eventually you’ll get a video that goes viral after enough experimentation&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Experiment and somehow turn that video into a “series”&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Start tweaking and posting this “series” on multiple accounts&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Translate and create the same video with creators that speak Chinese, Spanish, etc&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Take the really mega-viral videos and sponsor other pages to repost them&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Use the mega-viral content for paid ads&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Eventually enough copycats will copy your video series and it’ll get played out and you restart at step 1&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Our video series “POV: You have an essay due” has probably generated 300 million+ views overall&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;It was essentially the same video over and over, multiple times a week, yet they consistently went viral&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;That one video series made us over half a million dollars, and it was one of several video series’ that we were able to cook up&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Influencer Marketing&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Find influencers&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Go to your users’ Instagram and see which influencers they are following. This should be easy if you’ve done user interviews correctly, if you have no social media handles of your users you should actually befriend your users and get to know them on a deeper level or you’re not going to make it&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Do this for several users and eventually you will find some influencers that are ‘popular’ among your target user demographic. Find these influencers and follow them all, it’s okay you only need 1-3&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Go to these influencer’s profile and click “suggested similar accounts” and you’ll get an easy list of hot leads that you can sponsor (you can continue to do this recursively for each new influencer that you find)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Also, be sure to see what hashtags these influencers are using when they post and then follow those hashtags as well&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Once you have a list of influencers, create a new Instagram/TikTok account and manually follow &amp;#x26; watch their videos all the way through and the algorithm will start automatically showing relevant influencers to you that you can then reach out to (this is a great way to lower the risk of getting scammed because the videos that show up organically on your FYP are less likely to be accounts that have bought followers/views)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;On your new account, you want to be on the hunt for smaller influencers, if a new-ish account has multiple videos with 100k+ views, it’s absolute GOLD&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Once you have a list of influencers who you are ready to partner up with, you can begin reaching out to them&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Reach out to influencers&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;DMs &gt; emails = higher response rate (at least for us)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;All messages need to be as detailed and tailored as possible, but most importantly as CONCISE as possible. This balance is hard but you’ll get a better feel for this as you notice what gets ignored and what doesn’t&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Demonstrate that you’re genuinely a fan of their content and that you’re excited to partner up. This is such a low bar but few founders actually put in the effort.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Why should they partner with you? Why will their audience love your product? Don’t talk about dumb shit like how many employees your company has or what round of fundraising you’re at (I suggest not talking about those vanity metrics in any situation, but I digress)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Make sure to indicate somewhere in the message that this is obviously a PAID promotion, influencers are constantly inundated by people who are begging them for free shoutouts or weird affiliate partnerships&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Expect more than 50% of influencers to not respond, but this % is very volatile depending on what industry you’re in, and how cool/well-known your product is&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;The good news is, as more influencers talk about your product it gets easier and easier to convince them to promote your product because they have heard of it before (unknown products could be risky or straight-up scams)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Negotiate&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;The highest priority is to align the incentives between you and the influencer. You should both want a banger video that converts&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Never pay upfront for videos (pay half upfront at most). Most influencers are fantastic people but some influencers will just try and drop a half-ass video once they get their check&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Try to split the payment so that some % comes from the number of conversions that they bring (you can track this via coupon code or UTM link). If they don’t want to do that, try to at least have some affiliate bonus&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Ask for their viewer demographics see which countries are viewing their content and compare that with the conversion rates of those countries for your product&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;See previous sponsored content that they’ve posted and see how those videos performed vs their usual content&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Negotiate the deal so that either they only receive some/all of the payment if it reaches a certain # of views (or a certain # of coupon code redemptions)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Don’t listen to these absolute garbage articles that tell you to pay based on the number of subscribers/followers that they have. The sole question you should be asking is, will they convert or will they not (at least in the early stage of your startup).&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Post content&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;You can’t use a general content strategy for all of your influencer partnerships because each influencer has a certain type of content that their audience likes. Your content can’t deviate too far from it or else it will have terrible watch times and you’re basically paying for a dud&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;If you don’t have experience with social media or making engaging content, just let the influencer make the video and then you approve it (after aligning your incentives, as we discussed in the last step)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;One important note is that views are irrelevant, we’ve had videos that got 30 MILLION views and gave us barely any conversions, whereas a video with 50k views converted like hotcakes. The video should make the viewers excited about what you’ve built not just have them hear what you made and then forget about it the second they scroll to the next video on their For You Page&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;-When in doubt, don’t be afraid of your video looking like a straight-up ad, even if it gets less views it will convert better than an influencer casually talking about your product for 15 seconds in a random “Day in the life” vlog&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Final tips&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;The biggest risk with influencer marketing is sponsoring a dead video or a video that gets a few hundred views or a few thousand views in low-converting countries. For that reason, make a portfolio of bets instead of hunting for the perfect deal. Do not allocate all of your marketing budget to a few large influencers&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;If the account has high conversion potential, but the first video flops, don’t be afraid to run it back again (often times you can get a better rate on the second video if the first video does poorly)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;You should be casting a large net and then doubling down on the winners and gathering data to get better at predicting which influencer would be great to sponsor&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;One good influencer partnership can make up for several influencer partnerships with negative ROI&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;The ultimate goal is to build out your influencer marketing arm and then bring on somebody to help run it so you can focus on other aspects of growth.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;You need to have all of your insights and data figured out so that when you bring somebody on, they can take your insights and devote all of their time to become even better than you are at influencer marketing.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;SEO&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;SEO is a tricky one because it can take so long to see results&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;That’s why I would never start with SEO because in the early-stages you want fast feedback cycles and SEO is the furthest from it&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;But the flip side is, when you really need SEO, you probably should’ve started on it 6 months prior to that point&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;For that reason my ideal order of what growth channels I would focus on is: Organic Short-form -&gt; Influencer Marketing -&gt; Paid Ads&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;And at any point when I felt like I had a deep understanding of who my powers users were I would start work on SEO and do it concurrently with whatever growth channel I was working on at that point in time&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here are some growth hacks for when you do start SEO work:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Taking featured snippets&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sometimes you’ll be ranking low on the first page, not getting much traffic. Pushing yourself to the top of the page can take a lot of effort and investment, but there’s a way to get there almost immediately.
If the search term you’re looking to rank for has a featured snippet, you can often easily take over the first spot by just tweaking your content to answer the query more precisely.&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The chances are your content already answers the question well enough, but it’s just not written in a way that Google realizes it. Use definitive phrases like “The answer is Yes, you can do X”. Use bulleted or ordered lists to make the answer concise and clear.&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;To find these opportunities, you can plug your domain into a tool like Ahrefs, Semrush or Search Atlas and filter the keywords you are ranking for by the SERP containing a featured snippet.&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;To keep it simple:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Plug your domain into SEO tool (ahrefs, semrush, searchatlas)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Look at keywords you’re ranking for already&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Filter results by the criteria of containing a featured snippet in the results&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Tweak your content to answer the query in the best way possible&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Jump from position 3-10 to 1&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Increasing brand name searches
Brand searches helps legitimize your startup in Google’s eyes and will help your content be seen as “trustworthy”.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;With this in mind, for your SEO you should be engaging in other marketing activities that necessitate brand searches.&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;To keep it simple:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;When doing organic social media marketing, encourage users to search out for your brand name instead of directly typing in the URL&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;When doing paid social marketing, utilizing view-through or engaged-view conversions to still track conversions made via Google searches so you can still optimize the social campaigns while reaping the SEO benefit.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Make it easy for search engines to understand your website
Search engines have gotten a lot better at understanding messy websites, but that doesn’t mean you shouldn’t make it as easy as possible for them.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Adding schema to your pages and giving clear cut definitions to your content can make it incredibly clear to any bots crawling your site what your site is about and what it is doing.&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The more the better, we’ve had a lot of limitations with this as we’re using Framer and we’ve found some types of schema quite hard to implement. However, we’ve done what we can and any type of schema is better than nothing (as long as it’s accurate)&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;To keep it simple:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Add relevant schema to any page that is suitable&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Mark up your landing pages with FAQ data, mark up your blog posts with article data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Accurately estimate your ROI from search engines
It’s been a long time since Google allowed us to see which keywords led to conversions in Google Analytics, however it’s super important to get as accurate of a picture as possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Many people will simply look at reports and anything under the “organic” or “search engines” column, they’ll count as an SEO conversion. But that’s simply not true, and it severely misinforms you.
By the nature of the tracking, it’s impossible to differentiate between branded conversions and non branded conversions with SEO.&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The closest we’ve been able to get to do this is with a custom tool, but you can replicate it manually as well&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Log into search console&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Select your time period&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Export your clicks for each query&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Remove all branded queries&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Go to your paid ads (preferably Google ads) platform and note down your conversion data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Slightly lower the conversion percentage (because paid typically converts better than organic, as you’re bidding based on a lot of other targeting metrics too)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Tally up all the clicks from search console&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Use the conversion percentage from paid ads (slightly lowered)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Calculate the amount of conversions you have received from SEO (excluding brand)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Times this by the average LTV of your customer&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is a much closer metric to reality than anything reported by any reporting software, especially if you have a lot of branded searches like us&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Paid Ads&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Founders will tell me their marketing strategy and marketing spend and sometimes I’ll be shocked&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Many are going to end up spend a sizable portion of their entire investment on google/meta ads, and the worst part is they aren’t even acquiring users at a profit, which genuinely makes me nauseous&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Especially in the early-stages, I honestly wouldn’t be burn ANY money on paid ads and only spend after some social media marketing first&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is because data is key when it comes to paid ads and you want as much accurate data as possible to feed into the ad platforms&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The algorithms work very well, but they need data to make the right decisions, and you can get this data from other growth channels before starting paid ads&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Why paid ads after influencer marketing and organic content:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;From influencer partnerships and organic short-form you will have a bunch of creatives that you can work/experiment/rework for paid ads&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;You get valuable customer feedback in the comments of your posts (how do target users describe your product, what they compare it to, what they like/don’t like about your product) which can be leveraged for ad copy and positioning&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;You can use the data from your social media partnerships to have better targeting for your ads on day 1 (what countries convert better, what’s the LTV of each country, what types of users are ideal to market to, etc)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;In early-stages your budget won’t be big enough and you won’t be able to spend enough on Meta to get enough data for targeting based on purchase conversions&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;We only scaled paid ads after:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;PMF (Product Market Fit)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;3x LTV to CAC (we pay less than $1 for every $3 you make from ads)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Short payback period (we make back our money in less than 3 months)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Lastly, take special considerations of both the entire user journey and the landing page before you crank up adspend&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;If your landing page isn’t persuasive + effective it’ll not only get less conversions you will also pay more for each click. In Google it improves the relevancy score and in Meta it improves the quality ranking. An easy win is also just to speed up the loading time of your page, this can directly effect the quality score of your ads and will also lower spend per click&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Again, do not do paid ads until later in your startup’s lifecycle&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;It requires a larger budget, more data, and typically has higher cost per acquisition than other channels that you can start with&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;I personally also think it’s just the most boring growth channel so don’t deprive yourself of the joy of figuring out the other fun ones first haha&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Conclusion + Final Tip:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;For every level there is a new devil&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;As you scale up your paid ads, your cost per acquisition will continue to creep upwards&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;As you scale your influencer marketing you may actually run out of influencers to sponsor for your target user demographic&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;There’s always some content strategy that stops working on your social media accounts, or a random Google update that threatens to fuck your rankings&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;At each stage of scaling you’ll come across a myriad of issues that can only be solved by specialized knowledge and intense focus&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Scaling to $5M ARR is too difficult for one man to do (unless you’re the Lisan Al Gaib of startups)&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now that you’ve read this entire guide you can just choose which growth channel to start with and throw your whole weight into it until you solve it and you can move to the next one&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Once you start acquiring users profitably with that first growth channel, find someone who either has the skillset to take over or someone who you can train to take over&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is a critical step&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;To get to $5M ARR you need to know how to find, hire, and retain amazing talent&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This could be an entire post on it’s own because hiring is so tricky, but I will say that I highly highly bias towards resiliency + speed over experience&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Why do I care if a candidate has 15 years of digital marketing experience?&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Half of our marketing work has to do with short-form content and you could’ve only become an expert in short-form (TikTok, Reels, YT Shorts) in the last 3 years anyways&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;A young marketer with TikTok brain rot who has a great work ethic will often times outperform the “established” digital marketing agency with a ton of fake google reviews&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Today, our entire marketing team is just 3 people (me included), and I couldn’t have gotten anywhere close to $5M ARR without them&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Thanks to my growth team composed of Justin and Luke who are rockstars at what they do and helped flesh out a lot of the strategies on this post&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Since you’ve made it all the way to the bottom I’ll tell you one final secret&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Look at the bottom right of this tweet and count the bookmarks&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;How many of those people will actually read this whole thing? 10%?&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;How many of them will then actually try to implement some of the strategies I wrote about here? 10% of the 10%?&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;How many of them will continue to try 1 year from now when these marketing tactics help them uncover deep flaws in their product? 1% of that?&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This post will be read by hundreds of thousands of people but ultimately it will only be properly utilized by literally one or two of you&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;I hope you are that one person that I wrote this for and I hope you can go on a similar fantastical journey that I got to experience&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
&lt;p&gt;中文：&lt;/p&gt;
&lt;p&gt;如何从0开始以盈利的方式达到500万美元的年度经常性收入（ARR）（一步一步）&lt;/p&gt;
&lt;p&gt;以下是我们为每个分销渠道使用的所有增长黑客：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;有机短视频内容&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;影响者营销&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;搜索引擎优化（SEO）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;付费广告&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;有机短视频内容&lt;/p&gt;
&lt;p&gt;在这个社交媒体的新时代，最重要的事情是要记住粉丝数量根本不重要。&lt;/p&gt;
&lt;p&gt;如果他们的观看次数相似，我宁愿无讽刺地赞助一个本周刚创建的新账户，而不是一个拥有百万订阅者的YouTuber，我甚至不认为这是一个有争议的观点（尤其是当你考虑到那个著名的YouTuber可能会因为你得到的结果更少而向你收取高达30倍的费用，但如果价格相同，我甚至可能会选择新账户）。&lt;/p&gt;
&lt;p&gt;原因在于新账户非常不稳定，如果你发布了一个很棒的、引人入胜的内容，那么不管粉丝数量有多少，它都很容易走红。&lt;/p&gt;
&lt;p&gt;但与其在你的领域中寻找和赞助这些新账户，你完全可以自己创建这些账户。&lt;/p&gt;
&lt;p&gt;你只需要遵循这个基本格式：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;为你的账户找一个面孔&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;制作一个病毒式视频“系列”&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;增加你的账户数量&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;如果BTS创建了一个新的TikTok账户并开始发布，会发生什么？&lt;/p&gt;
&lt;p&gt;新账户的所有视频会立即走红，因为算法会将视频推送回他们的粉丝。&lt;/p&gt;
&lt;p&gt;尽管拥有零粉丝，这个新的TikTok账户将表现得好像它有数亿粉丝。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;一个好的技巧是找到一个已经拥有你确信会转化的受众的人，然后请他们在一个全新的账户上发布关于你们产品的视频。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;这个技巧之所以惊人，是因为创作者通常非常开放这个想法，因为它不会稀释他们的主要页面，支付20个新账户上的视频每月的费用比支付他们主要账户上的20个赞助帖子要便宜得多，而且会得到更好的结果。&lt;/p&gt;
&lt;p&gt;例如，我们找到了一个名叫Mengmengduck的创作者，他当时的整个账户都在教学生们如何给雇主写信，我们每月支付他4000美元制作20个视频。&lt;/p&gt;
&lt;p&gt;在第一个月，我们获得了超过700万次曝光，正如预期的那样，新账户上的视频被推送到了他主要账户的追随者那里。&lt;/p&gt;
&lt;p&gt;当你得到一个新的创作者时，只需遵循这个基本指南：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;在所有平台上重新发布视频（Reels、TikTok、YT Shorts）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;每天发布1个以上视频&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;最初，发布与影响者在他们主要账户上发布的内容类似的视频，然后开始尝试展示你们产品的视频&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;我们每月支付4000美元给拥有50万粉丝的MMD，但你可以用更便宜的价格找到类似效果的人！&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;与创作者合作的整个目标是找到一个病毒式“系列”，因为一旦一个视频走红，它就会再次走红。&lt;/p&gt;
&lt;p&gt;你想要一个视频，你可以基本上稍微调整一下，然后每周多次重新发布，对观众来说仍然很有趣。&lt;/p&gt;
&lt;p&gt;一旦你找到了一个病毒系列，你可以开始创建新账户，但这次你不需要与大创作者合作，你只需要找到有魅力的UGC创作者，因为你们已经找到了引人入胜、准备走红的内容。&lt;/p&gt;
&lt;p&gt;目前，我们大约有5个不同的Jenni AI账户都在发布类似的内容。&lt;/p&gt;
&lt;p&gt;我们的许多账户只有几十个或有时只有几百个粉丝，他们只是从我们的主要账户重新发布内容。&lt;/p&gt;
&lt;p&gt;在某些情况下，拥有48个粉丝的账户比我们拥有55k粉丝的主要账户获得的观看次数更多……即使发布相同的视频。&lt;/p&gt;
&lt;p&gt;病毒系列的例子：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;一个男人试图看看需要多少根意大利面才能支撑他的体重。然后他尝试看看需要多少个衣架。然后他尝试使用纸张。等等等等。所有相同的视频，最小的努力，但每次都能走红。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;一个男人每有1000个粉丝就喝一杯牛奶。每天都是相同的视频，他喝牛奶，但人们不断地收看，因为他们想看到他受苦，喝几百杯牛奶。每次都能走红。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;对于我们来说，我们有“POV你有一个论文到期”，这只是一个人意识到他们在拉屎时或者在睡觉前有一篇论文到期的荒谬情节，它总是以他们使用Jenni AI帮助他们更快地写论文结束。相同的视频，每次稍微不同的10秒开场。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;想出新的病毒视频创意很难，所以试着调整你的几个获胜视频到“系列”，只是想延长你内容的寿命。&lt;/p&gt;
&lt;p&gt;病毒性的顺序：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;在每个平台上都有一个账户（TikTok、Instagram、YT shorts）并尝试大量的钩子和视频创意&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;最终你会在足够的实验后得到一个走红的视频&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;实验并设法将那个视频变成一个“系列”&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;开始在多个账户上调整和发布这个“系列”&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;翻译并创建与讲中文、西班牙语等创作者相同的视频&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;拿真正超级病毒的视频，赞助其他页面重新发布它们&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用超级病毒内容进行付费广告&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;最终，足够的模仿者会复制你的视频系列，它会被玩坏，然后你从第一步重新开始&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;我们的“POV：你有一个论文到期”视频系列可能总共产生了超过3亿次观看&lt;/p&gt;
&lt;p&gt;它本质上是相同的视频一遍又一遍，每周多次，但它们始终走红。&lt;/p&gt;
&lt;p&gt;那个视频系列为我们赚了超过五十万美元，它是我们能够制作的几个视频系列之一。&lt;/p&gt;
&lt;p&gt;影响者营销&lt;/p&gt;
&lt;p&gt;寻找影响者&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;去你用户的Instagram看看他们关注了哪些影响者。如果你正确地进行了用户访谈，这应该是容易的，如果你没有用户的社交媒体账号，你实际上应该与你的用户成为朋友，更深入地了解他们，否则你不会成功&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;对几个用户这样做，最终你会发现一些在你目标用户群体中“流行”的影响者。找到这些影响者并关注他们，没关系，你只需要1-3个&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;去这些影响者的主页，点击“建议的类似账户”，你会得到一个你可以赞助的热门潜在客户的简单列表（你可以继续为每个新发现的影响者递归地做这个）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;另外，确保看看这些影响者在发布时使用什么标签，然后也关注这些标签&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;一旦你有了一份影响者名单，创建一个新的Instagram/TikTok账户，并手动关注他们，观看他们的视频，算法将开始自动向你展示相关的你可以联系的影响者（这是降低被诈骗风险的好方法，因为出现在你的FYP上的自然视频不太可能是购买了粉丝/观看次数的账户）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在你的新账户上，你想寻找小影响者，如果一个新账户有多个视频有10万+观看次数，那是绝对的金子&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;一旦你有了一份你准备与之合作的影响者名单，你可以开始联系他们&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;联系影响者&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;直接消息&gt;电子邮件=更高的回复率（至少对我们来说是这样）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;所有消息需要尽可能详细和定制，但最重要的是尽可能简洁。这种平衡很难，但随着你注意到什么被忽略，什么没有，你会更好地感受到这一点&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;证明你真的是他们内容的粉丝，并且你对合作感到兴奋。这是一个很低的门槛，但很少有创始人真的付出努力。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;他们为什么要与你合作？为什么他们的观众会喜欢你的产品？不要谈论你们公司有多少员工或者你在哪个融资轮次这样的蠢事（我建议在任何情况下都不要谈论这些虚荣指标，但我离题了）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;确保在消息的某个地方表明这显然是一个付费推广，影响者不断地被要求免费宣传或奇怪的联盟合作的人淹没&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;预计超过50%的影响者不会回应，但这个百分比非常不稳定，取决于你所在的行业，以及你的产品有多酷/知名&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;好消息是，随着越来越多的影响者谈论你的产品，说服他们推广你的产品变得越来越容易，因为他们之前已经听说过它（未知的产品可能是有风险的，或者完全是骗局）&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;谈判&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;最高优先级是将你和影响者之间的激励对齐。你们都希望有一个转化率高的视频&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;永远不要预先支付视频费用（最多预付一半）。大多数影响者都是很棒的人，但有些影响者会在拿到支票后尝试发布一个半吊子的视频&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;尝试将支付分成两部分，一部分来自他们带来的转化次数（你可以通过优惠券代码或UTM链接跟踪这一点）。如果他们不想这样做，至少有一些联盟奖金&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;询问他们的观众人口统计，看看哪些国家在观看他们的内容，并将其与你的产品在这些国家的转化率进行比较&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查看他们之前发布的赞助内容，并看看这些视频与他们的常规内容相比表现如何&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;谈判交易，使他们只有在达到一定数量的观看次数（或一定数量的优惠券代码兑换）时才收到部分/全部付款&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;不要听那些告诉你根据他们拥有的订阅者/粉丝数量支付的绝对垃圾文章。你应该问的唯一问题是，他们会转化还是不会（至少在创业初期）。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;发布内容&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;你不能为所有影响者合作伙伴使用一般的内容策略，因为每个影响者都有某种类型的他们观众喜欢的内容。你的内容不能偏离太远，否则它将有糟糕的观看时间和你基本上是在为一个失败者付费&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;如果你没有社交媒体或制作引人入胜的内容的经验，就让影响者制作视频，然后你批准它（在我们在上一步讨论的对齐激励之后）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;一个重要的注意事项是，观看次数无关紧要，我们有视频获得了3000万次观看，几乎没有转化，而一个有5万次观看的视频转化得像热蛋糕一样。视频应该让观看者对你们构建的东西感到兴奋，而不仅仅是让他们听到你们做了什么，然后在他们滚动到他们的For You页面上的下一个视频时就忘记了&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;如果有疑问，不要害怕你的视频看起来像一个直接的广告，即使它获得的观看次数更少，它也会比影响者在随机的“一天的生活”视频博客中随意谈论你的产品15秒更好地转化&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;最后提示&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;影响者营销的最大风险是赞助一个死亡视频或一个在低转化国家获得几百次或几千次观看的视频。因此，与其寻找完美的交易，不如做一个投资组合。不要将所有营销预算分配给几个大影响者&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;如果账户有高转化潜力，但第一个视频失败了，不要害怕再次运行它（通常如果第一个视频表现不佳，你可以在第二个视频上获得更好的价格）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;你应该撒一个大网，然后对赢家加倍下注，并收集数据，以更好地预测哪个影响者值得赞助&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;一个好的影响者合作伙伴可以弥补几个ROI为负的影响者合作伙伴&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;最终目标是建立你的影响者营销部门，然后引进某人来帮助运营，以便你可以专注于其他增长方面。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;你需要弄清楚你所有的见解和数据，以便当你引进某人时，他们可以采取你的见解，并投入他们所有的时间，成为比你在影响者营销方面更优秀的人。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;SEO&lt;/p&gt;
&lt;p&gt;SEO是一个棘手的问题，因为它可能需要很长时间才能看到结果&lt;/p&gt;
&lt;p&gt;这就是为什么我永远不会从SEO开始，因为在早期阶段，你想要快速的反馈周期，而SEO是最远离它的&lt;/p&gt;
&lt;p&gt;但另一方面，当你真的需要SEO时，你可能应该在那个时候之前6个月就开始了&lt;/p&gt;
&lt;p&gt;因此，我理想的增长渠道顺序是：有机短视频 -&gt; 影响者营销 -&gt; 付费广告&lt;/p&gt;
&lt;p&gt;并且任何时候，当我觉得自己对我的主要用户有了深入的了解时，我就会开始SEO工作，并与我当时正在工作的任何增长渠道同时进行&lt;/p&gt;
&lt;p&gt;以下是一些你开始SEO工作时的增长黑客：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;获得精选片段&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;有时你会在第一页排名很低，没有获得太多流量。将自己推向页面顶部可能需要很多努力和投资，但有一种方法可以让你几乎立即到达那里。
如果你想要排名的搜索词有一个精选片段，你通常可以通过简单地调整你的内容来回答查询更精确地接管第一位置。&lt;/p&gt;
&lt;p&gt;很可能你的内容已经足够好地回答了问题，但它只是没有以谷歌意识到的方式书写。使用明确的短语，如“答案是是的，你可以做X”。使用项目符号或有序列表使答案简洁明了。&lt;/p&gt;
&lt;p&gt;要找到这些机会，你可以将你的域名插入像Ahrefs、Semrush或Search Atlas这样的工具，并筛选你正在排名的关键词，这些关键词的SERP包含精选片段。&lt;/p&gt;
&lt;p&gt;保持简单：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;将你的域名插入SEO工具（ahrefs、semrush、searchatlas）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查看你正在排名的关键词&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;根据结果中包含精选片段的标准过滤结果&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;调整你的内容，尽可能好地回答查询&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;从第3-10位跳到第1位&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;增加品牌名称搜索
品牌搜索有助于在谷歌眼中合法化你的创业公司，并有助于你的内容被视为“可信”。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;考虑到这一点，对于你的SEO，你应该参与其他需要品牌搜索的营销活动。&lt;/p&gt;
&lt;p&gt;保持简单：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;在进行有机社交媒体营销时，鼓励用户搜索你的品牌名称，而不是直接输入URL&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在进行付费社交媒体营销时，利用视图通过或参与视图转换，仍然可以通过谷歌搜索进行跟踪转换，因此你仍然可以优化社交媒体活动，同时获得SEO好处。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;让搜索引擎更容易理解你的网站
搜索引擎已经变得更擅长理解混乱的网站，但这并不意味着你不应该尽可能让它们更容易。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;在你的页面上添加模式，并给你的内容提供明确的定义，可以让任何爬取你网站的机器人非常清楚你的网站是关于什么的，以及它正在做什么。&lt;/p&gt;
&lt;p&gt;越多越好，我们使用Framer时有很多限制，我们发现一些类型的模式很难实现。然而，我们已经尽力了，任何类型的模式都比没有好（只要它是准确的）&lt;/p&gt;
&lt;p&gt;保持简单：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;在任何合适的页面上添加相关模式&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;用FAQ数据标记你的着陆页，用文章数据标记你的博客文章。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;准确估计你从搜索引擎获得的投资回报率
谷歌很久以前就不再允许我们在Google Analytics中看到哪些关键词导致了转化，但这非常重要，要尽可能准确地了解情况。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;许多人只会看报告，任何在“有机”或“搜索引擎”列下的东西，他们都会算作SEO转化。但那根本不是真的，它严重误导了你。
根据跟踪的性质，用SEO无法区分品牌转化和非品牌转化。&lt;/p&gt;
&lt;p&gt;我们能够做到的最接近的事情是使用一个自定义工具，但你也可以手动复制它&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;登录搜索控制台&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;选择你的时间段&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;导出每个查询的点击次数&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;移除所有品牌查询&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;去你的付费广告平台（最好是谷歌广告）并记下你的转化数据。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;稍微降低转化百分比（因为付费通常比有机转化更好，因为你是基于很多其他定位指标出价的）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;统计搜索控制台的所有点击次数&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用付费广告的转化百分比（稍微降低）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;计算你从SEO获得的转化数量（不包括品牌）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;乘以你客户的平均LTV&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这比任何报告软件报告的任何东西都更接近现实，特别是如果你有很多品牌搜索，就像我们一样&lt;/p&gt;
&lt;p&gt;付费广告&lt;/p&gt;
&lt;p&gt;创始人会告诉我他们的营销策略和营销支出，有时我会震惊&lt;/p&gt;
&lt;p&gt;许多人将把他们的整个投资的相当一部分花在谷歌/Meta广告上，最糟糕的是他们甚至没有以盈利的方式获得用户，这真的让我感到恶心&lt;/p&gt;
&lt;p&gt;特别是在早期阶段，我真的不会在付费广告上花费任何钱，只有在一些社交媒体营销之后才花费&lt;/p&gt;
&lt;p&gt;这是因为数据对于付费广告至关重要，你希望尽可能多的准确数据输入到广告平台&lt;/p&gt;
&lt;p&gt;算法工作得很好，但它们需要数据来做出正确的决定，你可以从其他增长渠道获得这些数据，然后再开始付费广告&lt;/p&gt;
&lt;p&gt;为什么在影响者营销和有机内容之后进行付费广告：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;从影响者合作伙伴关系和有机短视频中，你将拥有一堆创意，你可以为付费广告工作/实验/重新工作&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;你可以在帖子的评论中获得宝贵的客户反馈（目标用户如何描述你的产品，他们将其与什么进行比较，他们喜欢/不喜欢你的产品的什么）这可以用于广告文案和定位&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;你可以使用你的社交媒体合作伙伴的数据，从第一天起就有更好地定位你的广告（哪些国家转化更好，每个国家的LTV是多少，哪些类型的用户是理想的市场对象等）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在早期阶段，你的预算将不够大，你无法在Meta上花费足够的钱，以获得基于购买转化的目标数据&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;我们只有在以下情况下才扩大付费广告：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PMF（产品市场契合度）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;3x LTV到CAC（我们每从广告中赚取3美元，支付不到1美元）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;短期回本期（我们在不到3个月内收回我们的资金）&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;最后，在你增加广告支出之前，特别注意整个用户旅程和着陆页面&lt;/p&gt;
&lt;p&gt;如果你的着陆页面没有说服力+有效，它不仅会获得更少的转化，你还会为每次点击支付更多。在谷歌上，它提高了相关性得分，在Meta上，它提高了质量排名。另一个简单的胜利就是加快你页面的加载时间，这可以直接影响你的广告质量得分，并降低每次点击的成本&lt;/p&gt;
&lt;p&gt;再次强调，不要在你的创业生命周期的后期之前做付费广告&lt;/p&gt;
&lt;p&gt;它需要更大的预算，更多的数据，通常比其他你可以开始的渠道有更高的客户获取成本&lt;/p&gt;
&lt;p&gt;我个人还认为这只是最无聊的增长渠道，所以不要剥夺自己弄清楚其他有趣渠道的乐趣哈哈&lt;/p&gt;
&lt;p&gt;结论+最后提示：&lt;/p&gt;
&lt;p&gt;每个层次都有一个新的魔鬼&lt;/p&gt;
&lt;p&gt;随着你扩大付费广告，你的每次获取成本将继续上升&lt;/p&gt;
&lt;p&gt;随着你扩大影响者营销，你实际上可能会为你的目标用户群体用完影响者&lt;/p&gt;
&lt;p&gt;总有一些内容策略在你的社交媒体账户上停止工作，或者一个随机的谷歌更新威胁要搞砸你的排名&lt;/p&gt;
&lt;p&gt;在每个扩展阶段，你都会遇到一系列问题，只能通过专业知识和专注来解决&lt;/p&gt;
&lt;p&gt;扩展到500万美元ARR对于一个人来说太难了（除非你是Lisan Al Gaib的创业公司）&lt;/p&gt;
&lt;p&gt;现在你已经读了整个指南，你可以选择从哪个增长渠道开始，把你的全部重量投入到它，直到你解决它，然后你可以移动到下一个&lt;/p&gt;
&lt;p&gt;一旦你开始通过第一个增长渠道以盈利的方式获得用户，找到有人要么有技能接管，要么有人你可以训练接管&lt;/p&gt;
&lt;p&gt;这是一个关键步骤&lt;/p&gt;
&lt;p&gt;要达到500万美元ARR，你需要知道如何找到、雇佣和留住出色的人才&lt;/p&gt;
&lt;p&gt;这可能是一个完整的帖子本身，因为招聘非常棘手，但我会说我对韧性+速度的偏见远远超过经验&lt;/p&gt;
&lt;p&gt;我为什么在乎一个候选人有15年的数字营销经验？&lt;/p&gt;
&lt;p&gt;我们的营销工作的一半与短视频内容有关，你只能在过去的3年里成为短视频（TikTok、Reels、YT Shorts）的专家&lt;/p&gt;
&lt;p&gt;一个有TikTok脑腐的年轻营销人员，有很好的工作伦理，通常会比有很多假谷歌评论的“建立”数字营销机构表现得更好&lt;/p&gt;
&lt;p&gt;今天，我们的整个营销团队只有3个人（包括我），没有他们，我不可能接近500万美元ARR&lt;/p&gt;
&lt;p&gt;感谢我的增长团队由Justin和Luke组成，他们是他们所做的摇滚明星，并帮助充实了这篇文章中的许多策略&lt;/p&gt;
&lt;p&gt;既然你已经读到了底部，我会告诉你一个最后的秘密&lt;/p&gt;
&lt;p&gt;看看这条推文的右下角，数一数书签&lt;/p&gt;
&lt;p&gt;有多少人会真正阅读这个？&lt;/p&gt;
&lt;p&gt;10%？&lt;/p&gt;
&lt;p&gt;然后有多少人会尝试实施我在这里写的一些策略？&lt;/p&gt;
&lt;p&gt;10%的10%？&lt;/p&gt;
&lt;p&gt;一年后，当这些营销策略帮助他们发现他们产品的深层缺陷时，还有多少人会继续尝试？&lt;/p&gt;
&lt;p&gt;1%的那个？&lt;/p&gt;
&lt;p&gt;这篇文章将被成千上万的人阅读，但最终只有你们中的一两个人会正确使用它&lt;/p&gt;
&lt;p&gt;我希望你是我为这篇文章写的那一个人，我希望你也能经历一个类似的奇妙旅程&lt;/p&gt;
&lt;p&gt;祝你好运！&lt;/p&gt;</content:encoded><category>创业笔记</category><category>创业笔记</category><category>产品运营</category></item><item><title>库斯图里卡的鞋带与大模型</title><link>https://pxiaoer.blog/posts/2024/%E5%BA%93%E6%96%AF%E5%9B%BE%E9%87%8C%E5%8D%A1%E7%9A%84%E9%9E%8B%E5%B8%A6%E4%B8%8E%E5%A4%A7%E6%A8%A1%E5%9E%8B/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/%E5%BA%93%E6%96%AF%E5%9B%BE%E9%87%8C%E5%8D%A1%E7%9A%84%E9%9E%8B%E5%B8%A6%E4%B8%8E%E5%A4%A7%E6%A8%A1%E5%9E%8B/</guid><description>本文公众号链接：[库斯图里卡的鞋带与大模型 ]</description><pubDate>Mon, 28 Oct 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;本文公众号链接：&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126482&amp;#x26;idx=1&amp;#x26;sn=da893efb13e7f59f45afdea8c65e1429&amp;#x26;chksm=80af3ff8b7d8b6ee3175fbc78099cb56439a5b9111611087e2603865b2fceddd4b97ab5b217d&amp;#x26;token=1552032182&amp;#x26;lang=zh_CN#rd&quot;&gt;库斯图里卡的鞋带与大模型 &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2024/10/image.png&quot; alt=&quot;本文公众号链接：库斯图里卡的鞋带与大模型&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;库斯图里卡的鞋带&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;《库斯图里卡的鞋带》是我正在读的余华最新作品《山谷微风》的第二篇文章，读完感触颇深，因此想写点感想。&lt;/p&gt;
&lt;p&gt;文章大致讲述了作者在塞尔维亚第一次见到库斯图里卡时，发现他没有系鞋带。后面几年几次见面，依然如此。最终，库斯图里卡在一个公共场合解释了这一点:  不系鞋带代表他目前身心放松，而系上鞋带就意味着他很紧张，随时准备逃跑。&lt;/p&gt;
&lt;p&gt;作者通过库斯图里卡的鞋带，借此说明人们已经逐渐学会应付某些人生经历，就像那些令人心惊胆战的少年经历一样——那些时刻准备“逃跑”的心态，会随着成长而逐渐消失。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2024/10/image-1.png&quot; alt=&quot;作者通过库斯图里卡的鞋带，借此说明人们已经逐渐学会应付某些人生经历，就像那些令人&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;口吃担忧症&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;文章并未止步于此，作者继续分享了”他”的少年经历——口吃。&lt;/p&gt;
&lt;p&gt;在2021年的公众号文章&lt;a href=&quot;http://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653125692&amp;#x26;idx=1&amp;#x26;sn=62afdcb763aa219b595c61b099bddad9&amp;#x26;chksm=80af3c96b7d8b580b026aac64ab7c910d0864923886b55941a363ded4405a37450516eee5cb2&amp;#x26;scene=21#wechat_redirect&quot;&gt;自信是一种天赋，叫我第一名&lt;/a&gt;中，我曾提到自己天生口吃，而作者则在小时候，觉得口吃很有趣、很酷，模仿他人，结果逐渐成了“正式的结巴”。&lt;/p&gt;
&lt;p&gt;作者的经历与我是十分相似——害怕与陌生人交流，越紧张说话越卡顿，甚至脸会涨得通红。我小时候口吃非常严重，常常被人嘲笑。大人们也常对我说：“不要结巴，想清楚再说，一口气说完就行。” 然而，口吃担忧症一直伴随着我，越是担心，越容易卡壳，直到最后我干脆闭嘴不说话。&lt;/p&gt;
&lt;p&gt;口吃伴随了我三十多年，现在改善了很多。大学时，知道我口吃的人并不多，工作后，经过认真准备，很多时候别人都听不出来我有口吃。近年来，由于我远程创业，日常与人交流减少，口吃似乎又有所回归。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;练习，重建信心&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;作者和我都曾努力打破口吃的困扰。作者在高中时被要求在大会上读一篇自己写的批判稿，这使他的口吃担忧症再次发作。读稿前，他已紧张到极点，站在麦克风前一度无法出声。最终，他每读一句都会停顿几次，反复结巴，台下的学生哄堂大笑。&lt;/p&gt;
&lt;p&gt;然而，作者将这次经历视为一种解脱，甚至认为他的口吃给同学们带来了欢乐。随着他成名，逐渐适应了采访和演讲，口吃也慢慢离他而去。&lt;/p&gt;
&lt;p&gt;我虽然没有作者那样频繁的采访和演讲机会，但也在努力争取更多的公众发言机会。记得我高中还曾因为口吃去竞选班长，结果意外当选，或许这也是一种积累自信后自我突破的机会。&lt;/p&gt;
&lt;p&gt;在我的实践里，语言是可以通过练习来改善的，最重要的是在这个过程中重建自信。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;语言是一种交流工具，不是思考工具&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;今年6月，MIT的一篇论文发表在《Nature》上，研究人员通过核磁共振成像扫描大脑的语言和思维区域，发现了语言系统与各种思维和推理系统之间的明显区别。具体而言，当人们进行各种形式的思考时，大脑的语言区域是沉默的，这证明了语言并不是思考的工具，而仅仅是交流的工具。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2024/10/image-2.png&quot; alt=&quot;今年6月，MIT的一篇论文发表在《Nature》上，研究人员通过核磁共振成像扫描&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;链接：&lt;a href=&quot;https://www.nature.com/articles/s41586-024-07522-w&quot;&gt;https://www.nature.com/articles/s41586-024-07522-w&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;从口吃的角度来看，我深信它不会影响我的思考。你可以将语言视为大脑的一种“外设”，它并不影响思维过程。&lt;/p&gt;
&lt;p&gt;这篇论文也从一定程度上证明了当前的大模型，虽然掌握了人类语言的某种表面形式，但在知识表征和推理方面尚有不足。这也是导致大模型在思考和推理上表现不佳的原因之一。&lt;/p&gt;
&lt;p&gt;目前的研究表明，语言即思考的观点显然是错误的。现阶段的大模型思考方式与人类的思考方式存在明显差异，即便通过具身智能进行环境感知，也无法使其成为真正的AGI。这是因为人类复杂的神经系统和生化反应极难模拟。&lt;/p&gt;
&lt;p&gt;或许，等到模型也开始“口吃”的那一天，AGI才真的到来。&lt;/p&gt;</content:encoded><category>读书笔记</category></item><item><title>AIGC周刊 第82期</title><link>https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC82%E6%9C%9F/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC82%E6%9C%9F/</guid><description>*因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。*</description><pubDate>Mon, 26 Aug 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/6c3e36e32a47d1d6.png&quot; alt=&quot;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;本周AIGC周刊链接&lt;/em&gt;：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-82&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-82&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&quot;top-papers-of-the-weekaugust-19---august-25&quot;&gt;Top Papers of the week（August 19 - August 25）&lt;/h3&gt;
&lt;p&gt;1.) &lt;strong&gt;Show-o: One Single Transformer to Unify Multimodal Understanding and Generation ( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We present a unified transformer, i.e., Show-o, that unifies multimodal understanding and generation. Unlike fully autoregressive models, Show-o unifies autoregressive and (discrete) diffusion modeling to adaptively handle inputs and outputs of various and mixed modalities. The unified model flexibly supports a wide range of vision-language tasks including visual question-answering, text-to-image generation, text-guided inpainting/extrapolation, and mixed-modality generation. Across various benchmarks, it demonstrates comparable or superior performance to existing individual models with an equivalent or larger number of parameters tailored for understanding or generation.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c744dffeb7ff210f.jpg&quot; alt=&quot;We present a unified transformer, i.e.&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) &lt;strong&gt;Transfusion: Predict the Next Token and Diffuse Images with One Multi-Modal Model ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We introduce Transfusion, a recipe for training a multi-modal model over discrete and continuous data. Transfusion combines the language modeling loss function (next token prediction) with diffusion to train a single transformer over mixed-modality sequences. We pretrain multiple Transfusion models up to 7B parameters from scratch on a mixture of text and image data, establishing scaling laws with respect to a variety of uni- and cross-modal benchmarks. Our experiments show that Transfusion scales significantly better than quantizing images and training a language model over discrete image tokens. By introducing modality-specific encoding and decoding layers, we can further improve the performance of Transfusion models, and even compress each image to just 16 patches. We further demonstrate that scaling our Transfusion recipe to 7B parameters and 2T multi-modal tokens produces a model that can generate images and text on a par with similar scale diffusion models and language models, reaping the benefits of both worlds.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/82cd507999828932.png&quot; alt=&quot;We introduce Transfusion, a recipe for t&quot;&gt;&lt;/p&gt;
&lt;p&gt;3.) &lt;strong&gt;Sapiens: Foundation for Human Vision Models ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We present Sapiens, a family of models for four fundamental human-centric vision tasks - 2D pose estimation, body-part segmentation, depth estimation, and surface normal prediction. Our models natively support 1K high-resolution inference and are extremely easy to adapt for individual tasks by simply fine-tuning models pretrained on over 300 million in-the-wild human images. We observe that, given the same computational budget, self-supervised pretraining on a curated dataset of human images significantly boosts the performance for a diverse set of human-centric tasks. The resulting models exhibit remarkable generalization to in-the-wild data, even when labeled data is scarce or entirely synthetic. Our simple model design also brings scalability - model performance across tasks improves as we scale the number of parameters from 0.3 to 2 billion. Sapiens consistently surpasses existing baselines across various human-centric benchmarks. We achieve significant improvements over the prior state-of-the-art on Humans-5K (pose) by 7.6 mAP, Humans-2K (part-seg) by 17.1 mIoU, Hi4D (depth) by 22.4% relative RMSE, and THuman2 (normal) by 53.5% relative angular error.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c33d15158d4e6a08.png&quot; alt=&quot;We present Sapiens, a family of models f&quot;&gt;&lt;/p&gt;
&lt;p&gt;4.)&lt;strong&gt;KAN 2.0: Kolmogorov-Arnold Networks Meet Science ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;major challenge of AI + Science lies in their inherent incompatibility: today’s AI is primarily based on connectionism, while science depends on symbolism. To bridge the two worlds, we propose a framework to seamlessly synergize Kolmogorov-Arnold Networks (KANs) and science. The framework highlights KANs’ usage for three aspects of scientific discovery: identifying relevant features, revealing modular structures, and discovering symbolic formulas. The synergy is bidirectional: science to KAN (incorporating scientific knowledge into KANs), and KAN to science (extracting scientific insights from KANs). We highlight major new functionalities in the pykan package: (1) MultKAN: KANs with multiplication nodes. (2) kanpiler: a KAN compiler that compiles symbolic formulas into KANs. (3) tree converter: convert KANs (or any neural networks) to tree graphs. Based on these tools, we demonstrate KANs’ capability to discover various types of physical laws, including conserved quantities, Lagrangians, symmetries, and constitutive laws.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/2daaffce26027e04.jpg&quot; alt=&quot;major challenge of AI + Science lies in&quot;&gt;&lt;/p&gt;
&lt;p&gt;5.) &lt;strong&gt;LongVILA: Scaling Long-Context Visual Language Models for Long Videos ( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Long-context capability is critical for multi-modal foundation models, especially for long video understanding. We introduce LongVILA, a full-stack solution for long-context visual-language models by co-designing the algorithm and system. For model training, we upgrade existing VLMs to support long video understanding by incorporating two additional stages, i.e., long context extension and long supervised fine-tuning. However, training on long video is computationally and memory intensive. We introduce the long-context Multi-Modal Sequence Parallelism (MM-SP) system that efficiently parallelizes long video training and inference, enabling 2M context length training on 256 GPUs without any gradient checkpointing. LongVILA efficiently extends the number of video frames of VILA from 8 to 1024, improving the long video captioning score from 2.00 to 3.26 (out of 5), achieving 99.5% accuracy in 1400-frame (274k context length) video needle-in-a-haystack. LongVILA-8B demonstrates consistent accuracy improvements on long videos in the VideoMME benchmark as the number of frames increases. Besides, MM-SP is 2.1x - 5.7x faster than ring sequence parallelism and 1.1x - 1.4x faster than Megatron with context parallelism + tensor parallelism. Moreover, it seamlessly integrates with Hugging Face Transformers.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/e4ab959236334bc3.jpg&quot; alt=&quot;Long context capability is critical for&quot;&gt;&lt;/p&gt;
&lt;p&gt;6.) &lt;strong&gt;T3M: Text Guided 3D Human Motion Synthesis from Speech ( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Speech-driven 3D motion synthesis seeks to create lifelike animations based on human speech, with potential uses in virtual reality, gaming, and the film production. Existing approaches reply solely on speech audio for motion generation, leading to inaccurate and inflexible synthesis results. To mitigate this problem, we introduce a novel text-guided 3D human motion synthesis method, termed \textit{T3M}. Unlike traditional approaches, T3M allows precise control over motion synthesis via textual input, enhancing the degree of diversity and user customization. The experiment results demonstrate that T3M can greatly outperform the state-of-the-art methods in both quantitative metrics and qualitative evaluations.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/6ef69ed76fbd110c.jpg&quot; alt=&quot;Speech driven 3D motion synthesis seeks&quot;&gt;&lt;/p&gt;
&lt;p&gt;7.) &lt;strong&gt;Automated Design of Agentic Systems ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Researchers are investing substantial effort in developing powerful general-purpose agents, wherein Foundation Models are used as modules within agentic systems (e.g. Chain-of-Thought, Self-Reflection, Toolformer). However, the history of machine learning teaches us that hand-designed solutions are eventually replaced by learned solutions. We formulate a new research area, Automated Design of Agentic Systems (ADAS), which aims to automatically create powerful agentic system designs, including inventing novel building blocks and/or combining them in new ways. We further demonstrate that there is an unexplored yet promising approach within ADAS where agents can be defined in code and new agents can be automatically discovered by a meta agent programming ever better ones in code. Given that programming languages are Turing Complete, this approach theoretically enables the learning of any possible agentic system: including novel prompts, tool use, control flows, and combinations thereof. We present a simple yet effective algorithm named Meta Agent Search to demonstrate this idea, where a meta agent iteratively programs interesting new agents based on an ever-growing archive of previous discoveries. Through extensive experiments across multiple domains including coding, science, and math, we show that our algorithm can progressively invent agents with novel designs that greatly outperform state-of-the-art hand-designed agents. Importantly, we consistently observe the surprising result that agents invented by Meta Agent Search maintain superior performance even when transferred across domains and models, demonstrating their robustness and generality. Provided we develop it safely, our work illustrates the potential of an exciting new research direction toward automatically designing ever-more powerful agentic systems to benefit humanity.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/a97f45e30ae2fbe3.jpg&quot; alt=&quot;Researchers are investing substantial ef&quot;&gt;&lt;/p&gt;
&lt;p&gt;8.) &lt;strong&gt;MagicDec: Breaking the Latency-Throughput Tradeoff for Long Context Generation with Speculative Decoding ( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Large Language Models (LLMs) have become more prevalent in long-context applications such as interactive chatbots, document analysis, and agent workflows, but it is challenging to serve long-context requests with low latency and high throughput. Speculative decoding (SD) is a widely used technique to reduce latency without sacrificing performance but the conventional wisdom suggests that its efficacy is limited to small batch sizes. In MagicDec, we show that surprisingly SD can achieve speedup even for a high throughput inference regime for moderate to long sequences. More interestingly, an intelligent drafting strategy can achieve better speedup with increasing batch size based on our rigorous analysis. MagicDec first identifies the bottleneck shifts with increasing batch size and sequence length, and uses these insights to deploy speculative decoding more effectively for high throughput inference. Then, it leverages draft models with sparse KV cache to address the KV bottleneck that scales with both sequence length and batch size. This finding underscores the broad applicability of speculative decoding in long-context serving, as it can enhance throughput and reduce latency without compromising accuracy. For moderate to long sequences, we demonstrate up to 2x speedup for LLaMA-2-7B-32K and 1.84x speedup for LLaMA-3.1-8B when serving batch sizes ranging from 32 to 256 on 8 NVIDIA A100 GPUs.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/5ce48bc62e3e8535.jpg&quot; alt=&quot;Large Language Models (LLMs) have become&quot;&gt;&lt;/p&gt;
&lt;p&gt;9.) &lt;strong&gt;Building and better understanding vision-language models: insights and future directions ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The field of vision-language models (VLMs), which take images and texts as inputs and output texts, is rapidly evolving and has yet to reach consensus on several key aspects of the development pipeline, including data, architecture, and training methods. This paper can be seen as a tutorial for building a VLM. We begin by providing a comprehensive overview of the current state-of-the-art approaches, highlighting the strengths and weaknesses of each, addressing the major challenges in the field, and suggesting promising research directions for underexplored areas. We then walk through the practical steps to build Idefics3-8B, a powerful VLM that significantly outperforms its predecessor Idefics2-8B, while being trained efficiently, exclusively on open datasets, and using a straightforward pipeline. These steps include the creation of Docmatix, a dataset for improving document understanding capabilities, which is 240 times larger than previously available datasets. We release the model along with the datasets created for its training.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/96287a2156c420f8.png&quot; alt=&quot;The field of vision language models (VLM&quot;&gt;&lt;/p&gt;
&lt;p&gt;10.) &lt;strong&gt;Graph Retrieval-Augmented Generation: A Survey ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Recently, Retrieval-Augmented Generation (RAG) has achieved remarkable success in addressing the challenges of Large Language Models (LLMs) without necessitating retraining. By referencing an external knowledge base, RAG refines LLM outputs, effectively mitigating issues such as “hallucination”, lack of domain-specific knowledge, and outdated information. However, the complex structure of relationships among different entities in databases presents challenges for RAG systems. In response, GraphRAG leverages structural information across entities to enable more precise and comprehensive retrieval, capturing relational knowledge and facilitating more accurate, context-aware responses. Given the novelty and potential of GraphRAG, a systematic review of current technologies is imperative. This paper provides the first comprehensive overview of GraphRAG methodologies. We formalize the GraphRAG workflow, encompassing Graph-Based Indexing, Graph-Guided Retrieval, and Graph-Enhanced Generation. We then outline the core technologies and training methods at each stage. Additionally, we examine downstream tasks, application domains, evaluation methodologies, and industrial use cases of GraphRAG. Finally, we explore future research directions to inspire further inquiries and advance progress in the field.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/45baa8ca45fd1e57.png&quot; alt=&quot;Recently, Retrieval Augmented Generation&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;aigc-news-of-the-weekaugust-19---august-25&quot;&gt;AIGC News of the week（August 19 - August 25）&lt;/h3&gt;
&lt;p&gt;1.) ReHiFace-S:Real Time High-Fidelity Faceswap ( repo )&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/f177fe73fd915fe7.png&quot; alt=&quot;1.) ReHiFace S:Real Time High Fidelity F&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) handwriter.ttf: Handwriting synthesis with Harfbuzz WASM ( repo )&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/fdd43d91a8bc7fbe.png&quot; alt=&quot;2.) handwriter.ttf: Handwriting synthesi&quot;&gt;&lt;/p&gt;
&lt;p&gt;3.) motleycrew:Flexible and powerful multi-agent AI framework ( repo )&lt;/p&gt;
&lt;p&gt;4.) Anthropic’s Prompt Engineering Interactive Tutorial ( link )&lt;/p&gt;
&lt;p&gt;5.) XLabs-AI/flux-ip-adapter ( link )&lt;/p&gt;
&lt;p&gt;Newsletter链接：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-82&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-82&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;更多AIGC News: AINews&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://ainews.kol.tools/&quot;&gt;https://ainews.kol.tools/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;欢迎关注我，也期待你和我的更多互动。&lt;/p&gt;</content:encoded><category>AIGC</category><category>AIGC Weekly</category><category>AI论文</category></item><item><title>AIGC周刊 第81期</title><link>https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC81%E6%9C%9F/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC81%E6%9C%9F/</guid><description>*因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。*</description><pubDate>Mon, 19 Aug 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/b514354802baabdd.jpg&quot; alt=&quot;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;本周AIGC周刊链接&lt;/em&gt;：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-81&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-81&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&quot;top-papers-of-the-weekaugust-12---august-18&quot;&gt;Top Papers of the week（August 12 - August 18）&lt;/h3&gt;
&lt;p&gt;1.) &lt;strong&gt;The AI Scientist: Towards Fully Automated Open-Ended Scientific Discovery ( blog | code | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;One of the grand challenges of artificial general intelligence is developing agents capable of conducting scientific research and discovering new knowledge. While frontier models have already been used as aides to human scientists, e.g. for brainstorming ideas, writing code, or prediction tasks, they still conduct only a small part of the scientific process. This paper presents the first comprehensive framework for fully automatic scientific discovery, enabling frontier large language models to perform research independently and communicate their findings. We introduce The AI Scientist, which generates novel research ideas, writes code, executes experiments, visualizes results, describes its findings by writing a full scientific paper, and then runs a simulated review process for evaluation. In principle, this process can be repeated to iteratively develop ideas in an open-ended fashion, acting like the human scientific community. We demonstrate its versatility by applying it to three distinct subfields of machine learning: diffusion modeling, transformer-based language modeling, and learning dynamics. Each idea is implemented and developed into a full paper at a cost of less than $15 per paper. To evaluate the generated papers, we design and validate an automated reviewer, which we show achieves near-human performance in evaluating paper scores. The AI Scientist can produce papers that exceed the acceptance threshold at a top machine learning conference as judged by our automated reviewer. This approach signifies the beginning of a new era in scientific discovery in machine learning: bringing the transformative benefits of AI agents to the entire research process of AI itself, and taking us closer to a world where endless affordable creativity and innovation can be unleashed on the world’s most challenging problems.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/24ec13ce6c4d9bbd.png&quot; alt=&quot;One of the grand challenges of artificia&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) &lt;strong&gt;LongWriter: Unleashing 10,000+ Word Generation from Long Context LLMs ( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Current long context large language models (LLMs) can process inputs up to 100,000 tokens, yet struggle to generate outputs exceeding even a modest length of 2,000 words. Through controlled experiments, we find that the model’s effective generation length is inherently bounded by the sample it has seen during supervised fine-tuning (SFT). In other words, their output limitation is due to the scarcity of long-output examples in existing SFT datasets. To address this, we introduce AgentWrite, an agent-based pipeline that decomposes ultra-long generation tasks into subtasks, enabling off-the-shelf LLMs to generate coherent outputs exceeding 20,000 words. Leveraging AgentWrite, we construct LongWriter-6k, a dataset containing 6,000 SFT data with output lengths ranging from 2k to 32k words. By incorporating this dataset into model training, we successfully scale the output length of existing models to over 10,000 words while maintaining output quality. We also develop LongBench-Write, a comprehensive benchmark for evaluating ultra-long generation capabilities. Our 9B parameter model, further improved through DPO, achieves state-of-the-art performance on this benchmark, surpassing even much larger proprietary models. In general, our work demonstrates that existing long context LLM already possesses the potential for a larger output window—all you need is data with extended output during model alignment to unlock this capability.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/d7ee8672cfb0842f.png&quot; alt=&quot;Current long context large language mode&quot;&gt;&lt;/p&gt;
&lt;p&gt;3.) &lt;strong&gt;Imagen 3 ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;We introduce Imagen 3, a latent diffusion model that generates high quality images from text prompts. We describe our quality and responsibility evaluations. Imagen 3 is preferred over other state-of-the-art (SOTA) models at the time of evaluation. In addition, we discuss issues around safety and representation, as well as methods we used to minimize the potential harm of our models.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/2e3555b0498c7033.jpg&quot; alt=&quot;We introduce Imagen 3, a latent diffusio&quot;&gt;&lt;/p&gt;
&lt;p&gt;4.) &lt;strong&gt;CogVideoX: Text-to-Video Diffusion Models with An Expert Transformer( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;We introduce CogVideoX, a large-scale diffusion transformer model designed for generating videos based on text prompts. To efficently model video data, we propose to levearge a 3D Variational Autoencoder (VAE) to compress videos along both spatial and temporal dimensions. To improve the text-video alignment, we propose an expert transformer with the expert adaptive LayerNorm to facilitate the deep fusion between the two modalities. By employing a progressive training technique, CogVideoX is adept at producing coherent, long-duration videos characterized by significant motions. In addition, we develop an effective text-video data processing pipeline that includes various data preprocessing strategies and a video captioning method. It significantly helps enhance the performance of CogVideoX, improving both generation quality and semantic alignment. Results show that CogVideoX demonstrates state-of-the-art performance across both multiple machine metrics and human evaluations.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/d17a888353c3952d.jpg&quot; alt=&quot;We introduce CogVideoX, a large scale di&quot;&gt;&lt;/p&gt;
&lt;p&gt;5.) &lt;strong&gt;OpenResearcher: Unleashing AI for Accelerated Scientific Research ( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The rapid growth of scientific literature imposes significant challenges for researchers endeavoring to stay updated with the latest advancements in their fields and delve into new areas. We introduce OpenResearcher, an innovative platform that leverages Artificial Intelligence (AI) techniques to accelerate the research process by answering diverse questions from researchers. OpenResearcher is built based on Retrieval-Augmented Generation (RAG) to integrate Large Language Models (LLMs) with up-to-date, domain-specific knowledge. Moreover, we develop various tools for OpenResearcher to understand researchers’ queries, search from the scientific literature, filter retrieved information, provide accurate and comprehensive answers, and self-refine these answers. OpenResearcher can flexibly use these tools to balance efficiency and effectiveness. As a result, OpenResearcher enables researchers to save time and increase their potential to discover new insights and drive scientific breakthroughs.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/872761bd15ce5c7a.png&quot; alt=&quot;The rapid growth of scientific literatur&quot;&gt;&lt;/p&gt;
&lt;p&gt;6.) &lt;strong&gt;enerative Photomontage  ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Text-to-image models are powerful tools for image creation. However, the generation process is akin to a dice roll and makes it difficult to achieve a single image that captures everything a user wants. In this paper, we propose a framework for creating the desired image by compositing it from various parts of generated images, in essence forming a Generative Photomontage. Given a stack of images generated by ControlNet using the same input condition and different seeds, we let users select desired parts from the generated results using a brush stroke interface. We introduce a novel technique that takes in the user’s brush strokes, segments the generated images using a graph-based optimization in diffusion feature space, and then composites the segmented regions via a new feature-space blending method. Our method faithfully preserves the user-selected regions while compositing them harmoniously. We demonstrate that our flexible framework can be used for many applications, including generating new appearance combinations, fixing incorrect shapes and artifacts, and improving prompt alignment. We show compelling results for each application and demonstrate that our method outperforms existing image blending methods and various baselines.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/6cab698c2e8495ae.jpg&quot; alt=&quot;Text to image models are powerful tools&quot;&gt;&lt;/p&gt;
&lt;p&gt;7.) &lt;strong&gt;ControlNeXt: Powerful and Efficient Control for Image and Video Generation ( webpage | paper | code)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Diffusion models have demonstrated remarkable and robust abilities in both image and video generation. To achieve greater control over generated results, researchers introduce additional architectures, such as ControlNet, Adapters and ReferenceNet, to integrate conditioning controls. However, current controllable generation methods often require substantial additional computational resources, especially for video generation, and face challenges in training or exhibit weak control. In this paper, we propose ControlNeXt: a powerful and efficient method for controllable image and video generation. We first design a more straightforward and efficient architecture, replacing heavy additional branches with minimal additional cost compared to the base model. Such a concise structure also allows our method to seamlessly integrate with other LoRA weights, enabling style alteration without the need for additional training. As for training, we reduce up to 90% of learnable parameters compared to the alternatives. Furthermore, we propose another method called Cross Normalization (CN) as a replacement for Zero-Convolution’ to achieve fast and stable training convergence. We have conducted various experiments with different base models across images and videos, demonstrating the robustness of our method.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/f81297506c98bad2.jpg&quot; alt=&quot;Diffusion models have demonstrated remar&quot;&gt;&lt;/p&gt;
&lt;p&gt;8.) &lt;strong&gt;HybridRAG: Integrating Knowledge Graphs and Vector Retrieval Augmented Generation for Efficient Information Extraction ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Extraction and interpretation of intricate information from unstructured text data arising in financial applications, such as earnings call transcripts, present substantial challenges to large language models (LLMs) even using the current best practices to use Retrieval Augmented Generation (RAG) (referred to as VectorRAG techniques which utilize vector databases for information retrieval) due to challenges such as domain specific terminology and complex formats of the documents. We introduce a novel approach based on a combination, called HybridRAG, of the Knowledge Graphs (KGs) based RAG techniques (called GraphRAG) and VectorRAG techniques to enhance question-answer (Q&amp;#x26;A) systems for information extraction from financial documents that is shown to be capable of generating accurate and contextually relevant answers. Using experiments on a set of financial earning call transcripts documents which come in the form of Q&amp;#x26;A format, and hence provide a natural set of pairs of ground-truth Q&amp;#x26;As, we show that HybridRAG which retrieves context from both vector database and KG outperforms both traditional VectorRAG and GraphRAG individually when evaluated at both the retrieval and generation stages in terms of retrieval accuracy and answer generation. The proposed technique has applications beyond the financial domain&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/3e27ac6e7b1a7980.jpg&quot; alt=&quot;Extraction and interpretation of intrica&quot;&gt;&lt;/p&gt;
&lt;p&gt;9.) &lt;strong&gt;Training Language Models on the Knowledge Graph: Insights on Hallucinations and Their Detectability ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;While many capabilities of language models (LMs) improve with increased training budget, the influence of scale on hallucinations is not yet fully understood. Hallucinations come in many forms, and there is no universally accepted definition. We thus focus on studying only those hallucinations where a correct answer appears verbatim in the training set. To fully control the training data content, we construct a knowledge graph (KG)-based dataset, and use it to train a set of increasingly large LMs. We find that for a fixed dataset, larger and longer-trained LMs hallucinate less. However, hallucinating on ≤5% of the training data requires an order of magnitude larger model, and thus an order of magnitude more compute, than Hoffmann et al. (2022) reported was optimal. Given this costliness, we study how hallucination detectors depend on scale. While we see detector size improves performance on fixed LM’s outputs, we find an inverse relationship between the scale of the LM and the detectability of its hallucinations.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/766374e4a76233d9.jpg&quot; alt=&quot;While many capabilities of language mode&quot;&gt;&lt;/p&gt;
&lt;p&gt;10.) &lt;strong&gt;Model Merging in LLMs, MLLMs, and Beyond: Methods, Theories, Applications and Opportunities ( paper | code )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Model merging is an efficient empowerment technique in the machine learning community that does not require the collection of raw training data and does not require expensive computation. As model merging becomes increasingly prevalent across various fields, it is crucial to understand the available model merging techniques comprehensively. However, there is a significant gap in the literature regarding a systematic and thorough review of these techniques. This survey provides a comprehensive overview of model merging methods and theories, their applications in various domains and settings, and future research directions. Specifically, we first propose a new taxonomic approach that exhaustively discusses existing model merging methods. Secondly, we discuss the application of model merging techniques in large language models, multimodal large language models, and 10+ machine learning subfields, including continual learning, multi-task learning, few-shot learning, etc. Finally, we highlight the remaining challenges of model merging and discuss future research directions.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/74a3989f61271cc3.png&quot; alt=&quot;Model merging is an efficient empowermen&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;aigc-news-of-the-weekaugust-12---august-18&quot;&gt;AIGC News of the week（August 12 - August 18）&lt;/h3&gt;
&lt;p&gt;1.) Grok-2 Beta Release ( link )&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/3618ff8eafd86d31.jpg&quot; alt=&quot;1.) Grok 2 Beta Release ( link )&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) ComfyUI-Inspyrenet-Rembg ( repo )&lt;/p&gt;
&lt;p&gt;3.) XLabs-AI/flux-controlnet-canny ( link )&lt;/p&gt;
&lt;p&gt;4.) Advanced RAG Techniques: Elevating Your Retrieval-Augmented Generation Systems ( repo )&lt;/p&gt;
&lt;p&gt;5.) New LLM Pre-training and Post-training Paradigms ( link )&lt;/p&gt;
&lt;p&gt;Newsletter链接：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-81&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-81&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;更多AIGC News: AINews&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://ainews.kol.tools/&quot;&gt;https://ainews.kol.tools/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;欢迎关注我，也期待你和我的更多互动。&lt;/p&gt;</content:encoded><category>AIGC</category><category>AIGC Weekly</category><category>AI论文</category></item><item><title>AIGC周刊 第80期</title><link>https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC80%E6%9C%9F/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC80%E6%9C%9F/</guid><description>*因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。*</description><pubDate>Mon, 12 Aug 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/b093ff2d4fc9d077.jpg&quot; alt=&quot;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;本周AIGC周刊链接&lt;/em&gt;：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-80&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-80&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&quot;&quot;&gt;&lt;/h3&gt;
&lt;h3 id=&quot;top-papers-of-the-weekaugust-05---august-11&quot;&gt;Top Papers of the week（August 05 - August 11）&lt;/h3&gt;
&lt;p&gt;1.) &lt;strong&gt;Self-Taught Evaluators ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Model-based evaluation is at the heart of successful model development — as a reward model for training, and as a replacement for human evaluation. To train such evaluators, the standard approach is to collect a large amount of human preference judgments over model responses, which is costly and the data becomes stale as models improve. In this work, we present an approach that aims to im-prove evaluators without human annotations, using synthetic training data only. Starting from unlabeled instructions, our iterative self-improvement scheme generates contrasting model outputs and trains an LLM-as-a-Judge to produce reasoning traces and final judgments, repeating this training at each new iteration using the improved predictions. Without any labeled preference data, our Self-Taught Evaluator can improve a strong LLM (Llama3-70B-Instruct) from 75.4 to 88.3 (88.7 with majority vote) on RewardBench. This outperforms commonly used LLM judges such as GPT-4 and matches the performance of the top-performing reward models trained with labeled examples.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/1dd75db1a9149826.png&quot; alt=&quot;Model based evaluation is at the heart o&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) &lt;strong&gt;MiniCPM-V: A GPT-4V Level MLLM on Your Phone ( paper | repo )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The recent surge of Multimodal Large Language Models (MLLMs) has fundamentally reshaped the landscape of AI research and industry, shedding light on a promising path toward the next AI milestone. However, significant challenges remain preventing MLLMs from being practical in real-world applications. The most notable challenge comes from the huge cost of running an MLLM with a massive number of parameters and extensive computation. As a result, most MLLMs need to be deployed on high-performing cloud servers, which greatly limits their application scopes such as mobile, offline, energy-sensitive, and privacy-protective scenarios. In this work, we present MiniCPM-V, a series of efficient MLLMs deployable on end-side devices. By integrating the latest MLLM techniques in architecture, pretraining and alignment, the latest MiniCPM-Llama3-V 2.5 has several notable features: (1) Strong performance, outperforming GPT-4V-1106, Gemini Pro and Claude 3 on OpenCompass, a comprehensive evaluation over 11 popular benchmarks, (2) strong OCR capability and 1.8M pixel high-resolution image perception at any aspect ratio, (3) trustworthy behavior with low hallucination rates, (4) multilingual support for 30+ languages, and (5) efficient deployment on mobile phones. More importantly, MiniCPM-V can be viewed as a representative example of a promising trend: The model sizes for achieving usable (e.g., GPT-4V) level performance are rapidly decreasing, along with the fast growth of end-side computation capacity. This jointly shows that GPT-4V level MLLMs deployed on end devices are becoming increasingly possible, unlocking a wider spectrum of real-world AI applications in the near future.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/37579e5e9c3fbb72.png&quot; alt=&quot;The recent surge of Multimodal Large Lan&quot;&gt;&lt;/p&gt;
&lt;p&gt;3.) &lt;strong&gt;Transformer Explainer: Interactive Learning of Text-Generative Models ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Transformers have revolutionized machine learning, yet their inner workings remain opaque to many. We present Transformer Explainer, an interactive visualization tool designed for non-experts to learn about Transformers through the GPT-2 model. Our tool helps users understand complex Transformer concepts by integrating a model overview and enabling smooth transitions across abstraction levels of mathematical operations and model structures. It runs a live GPT-2 instance locally in the user’s browser, empowering users to experiment with their own input and observe in real-time how the internal components and parameters of the Transformer work together to predict the next tokens. Our tool requires no installation or special hardware, broadening the public’s education access to modern generative AI techniques.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/3f7e90395d7816d3.jpg&quot; alt=&quot;Transformers have revolutionized machine&quot;&gt;&lt;/p&gt;
&lt;p&gt;4.) &lt;strong&gt;Fact Finder — Enhancing Domain Expertise of Large Language Models by Incorporating Knowledge Graphs ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Recent advancements in Large Language Models (LLMs) have showcased their proficiency in answering natural language queries. However, their effectiveness is hindered by limited domain-specific knowledge, raising concerns about the reliability of their responses. We introduce a hybrid system that augments LLMs with domain-specific knowledge graphs (KGs), thereby aiming to enhance factual correctness using a KG-based retrieval approach. We focus on a medical KG to demonstrate our methodology, which includes (1) pre-processing, (2) Cypher query generation, (3) Cypher query processing, (4) KG retrieval, and (5) LLM-enhanced response generation. We evaluate our system on a curated dataset of 69 samples, achieving a precision of 78% in retrieving correct KG nodes. Our findings indicate that the hybrid system surpasses a standalone LLM in accuracy and completeness, as verified by an LLM-as-a-Judge evaluation method. This positions the system as a promising tool for applications that demand factual correctness and completeness, such as target identification — a critical process in pinpointing biological entities for disease treatment or crop enhancement. Moreover, its intuitive search interface and ability to provide accurate responses within seconds make it well-suited for time-sensitive, precision-focused research contexts. We publish the source code together with the dataset and the prompt templates used.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/3e989ed7155bf0ea.png&quot; alt=&quot;Recent advancements in Large Language Mo&quot;&gt;&lt;/p&gt;
&lt;p&gt;5.) &lt;strong&gt;RAG Foundry: A Framework for Enhancing LLMs for Retrieval Augmented Generation ( paper | repo )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Implementing Retrieval-Augmented Generation (RAG) systems is inherently complex, requiring deep understanding of data, use cases, and intricate design decisions. Additionally, evaluating these systems presents significant challenges, necessitating assessment of both retrieval accuracy and generative quality through a multi-faceted approach. We introduce RAG Foundry, an open-source framework for augmenting large language models for RAG use cases. RAG Foundry integrates data creation, training, inference and evaluation into a single workflow, facilitating the creation of data-augmented datasets for training and evaluating large language models in RAG settings. This integration enables rapid prototyping and experimentation with various RAG techniques, allowing users to easily generate datasets and train RAG models using internal or specialized knowledge sources. We demonstrate the framework effectiveness by augmenting and fine-tuning Llama-3 and Phi-3 models with diverse RAG configurations, showcasing consistent improvements across three knowledge-intensive datasets.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/58cefd09c77fcb1e.png&quot; alt=&quot;Implementing Retrieval Augmented Generat&quot;&gt;&lt;/p&gt;
&lt;p&gt;6.) &lt;strong&gt;IPAdapter-Instruct: Resolving Ambiguity in Image-based Conditioning using Instruct Prompts ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Diffusion models continuously push the boundary of state-of-the-art image generation, but the process is hard to control with any nuance: practice proves that textual prompts are inadequate for accurately describing image style or fine structural details (such as faces). ControlNet and IPAdapter address this shortcoming by conditioning the generative process on imagery instead, but each individual instance is limited to modeling a single conditional posterior: for practical use-cases, where multiple different posteriors are desired within the same workflow, training and using multiple adapters is cumbersome. We propose IPAdapter-Instruct, which combines natural-image conditioning with “Instruct” prompts to swap between interpretations for the same conditioning image: style transfer, object extraction, both, or something else still? IPAdapterInstruct efficiently learns multiple tasks with minimal loss in quality compared to dedicated per-task models.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/ff158c9318307f69.jpg&quot; alt=&quot;Diffusion models continuously push the b&quot;&gt;&lt;/p&gt;
&lt;p&gt;7.) &lt;strong&gt;An Object is Worth 64x64 Pixels: Generating 3D Object via Image Diffusion ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We introduce a new approach for generating realistic 3D models with UV maps through a representation termed “Object Images.” This approach encapsulates surface geometry, appearance, and patch structures within a 64x64 pixel image, effectively converting complex 3D shapes into a more manageable 2D format. By doing so, we address the challenges of both geometric and semantic irregularity inherent in polygonal meshes. This method allows us to use image generation models, such as Diffusion Transformers, directly for 3D shape generation. Evaluated on the ABO dataset, our generated shapes with patch structures achieve point cloud FID comparable to recent 3D generative models, while naturally supporting PBR material generation.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/9ba94914e5b04c68.png&quot; alt=&quot;We introduce a new approach for generati&quot;&gt;&lt;/p&gt;
&lt;p&gt;8.) &lt;strong&gt;Sketch2Scene: Automatic Generation of Interactive 3D Game Scenes from User’s Casual Sketches ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;3D Content Generation is at the heart of many computer graphics applications, including video gaming, film-making, virtual and augmented reality, etc. This paper proposes a novel deep-learning based approach for automatically generating interactive and playable 3D game scenes, all from the user’s casual prompts such as a hand-drawn sketch. Sketch-based input offers a natural, and convenient way to convey the user’s design intention in the content creation process. To circumvent the data-deficient challenge in learning (i.e. the lack of large training data of 3D scenes), our method leverages a pre-trained 2D denoising diffusion model to generate a 2D image of the scene as the conceptual guidance. In this process, we adopt the isometric projection mode to factor out unknown camera poses while obtaining the scene layout. From the generated isometric image, we use a pre-trained image understanding method to segment the image into meaningful parts, such as off-ground objects, trees, and buildings, and extract the 2D scene layout. These segments and layouts are subsequently fed into a procedural content generation (PCG) engine, such as a 3D video game engine like Unity or Unreal, to create the 3D scene. The resulting 3D scene can be seamlessly integrated into a game development environment and is readily playable. Extensive tests demonstrate that our method can efficiently generate high-quality and interactive 3D game scenes with layouts that closely follow the user’s intention.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/8971f34ca3fc896f.jpg&quot; alt=&quot;3D Content Generation is at the heart of&quot;&gt;&lt;/p&gt;
&lt;p&gt;9.) &lt;strong&gt;Better Alignment with Instruction Back-and-Forth Translation ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We propose a new method, instruction back-and-forth translation, to construct high-quality synthetic data grounded in world knowledge for aligning large language models (LLMs). Given documents from a web corpus, we generate and curate synthetic instructions using the backtranslation approach proposed by Li et al.(2023a), and rewrite the responses to improve their quality further based on the initial documents. Fine-tuning with the resulting (backtranslated instruction, rewritten response) pairs yields higher win rates on AlpacaEval than using other common instruction datasets such as Humpback, ShareGPT, Open Orca, Alpaca-GPT4 and Self-instruct. We also demonstrate that rewriting the responses with an LLM outperforms direct distillation, and the two generated text distributions exhibit significant distinction in embedding space. Further analysis shows that our backtranslated instructions are of higher quality than other sources of synthetic instructions, while our responses are more diverse and complex than those obtained from distillation. Overall we find that instruction back-and-forth translation combines the best of both worlds — making use of the information diversity and quantity found on the web, while ensuring the quality of the responses which is necessary for effective alignment.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c2cef7f524db4aff.png&quot; alt=&quot;We propose a new method, instruction bac&quot;&gt;&lt;/p&gt;
&lt;p&gt;10.) &lt;strong&gt;Deep Generative Models in Robotics: A Survey on Learning from Multimodal Demonstrations ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Learning from Demonstrations, the field that proposes to learn robot behavior models from data, is gaining popularity with the emergence of deep generative models. Although the problem has been studied for years under names such as Imitation Learning, Behavioral Cloning, or Inverse Reinforcement Learning, classical methods have relied on models that don’t capture complex data distributions well or don’t scale well to large numbers of demonstrations. In recent years, the robot learning community has shown increasing interest in using deep generative models to capture the complexity of large datasets. In this survey, we aim to provide a unified and comprehensive review of the last year’s progress in the use of deep generative models in robotics. We present the different types of models that the community has explored, such as energy-based models, diffusion models, action value maps, or generative adversarial networks. We also present the different types of applications in which deep generative models have been used, from grasp generation to trajectory generation or cost learning. One of the most important elements of generative models is the generalization out of distributions. In our survey, we review the different decisions the community has made to improve the generalization of the learned models. Finally, we highlight the research challenges and propose a number of future directions for learning deep generative models in robotics.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/834da8dacefca96c.jpg&quot; alt=&quot;Learning from Demonstrations, the field&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;aigc-news-of-the-weekaugust-05---august-11&quot;&gt;AIGC News of the week（August 05 - August 11）&lt;/h3&gt;
&lt;p&gt;1.) GPT-4o System Card ( link )&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/5bde13c6480c1ec8.jpg&quot; alt=&quot;1.) GPT 4o System Card ( link )&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) Qwen2-Audio ( repo )&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/3a534f4196699965.jpg&quot; alt=&quot;2.) Qwen2 Audio ( repo )&quot;&gt;&lt;/p&gt;
&lt;p&gt;3.) ComfyUI Profiler: Calculate the execution time of all nodes ( repo )&lt;/p&gt;
&lt;p&gt;4.) roneneldan/TinyStories-33M ( link )&lt;/p&gt;
&lt;p&gt;5.) ComfyUI-Inspyrenet-Rembg ( repo )&lt;/p&gt;
&lt;p&gt;Newsletter链接：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-80&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-80&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;更多AIGC News: AINews&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://ainews.kol.tools/&quot;&gt;https://ainews.kol.tools/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;欢迎关注我，也期待你和我的更多互动。&lt;/p&gt;</content:encoded><category>AIGC</category><category>AIGC Weekly</category><category>AI论文</category></item><item><title>AIGC周刊 第79期</title><link>https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC79%E6%9C%9F/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/aigc%E5%91%A8%E5%88%8A-%E7%AC%AC79%E6%9C%9F/</guid><description>因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsl</description><pubDate>Mon, 05 Aug 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/6c836c0fda712759.jpg&quot; alt=&quot;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;本周AIGC周刊链接&lt;/em&gt;：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-79&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-79&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&quot;top-papers-of-the-weekjuly-29---august-04&quot;&gt;Top Papers of the week（July 29 - August 04）&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;1.) Apple Intelligence Foundation Language Models( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We present foundation language models developed to power Apple Intelligence features, including a ~3 billion parameter model designed to run efficiently on devices and a large server-based language model designed for Private Cloud Compute. These models are designed to perform a wide range of tasks efficiently, accurately, and responsibly. This report describes the model architecture, the data used to train the model, the training process, how the models are optimized for inference, and the evaluation results. We highlight our focus on Responsible AI and how the principles are applied throughout the model development.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c8c5a38d10b61550.png&quot; alt=&quot;We present foundation language models de&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2.) Meta-Rewarding Language Models: Self-Improving Alignment with LLM-as-a-Meta-Judge( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Large Language Models (LLMs) are rapidly surpassing human knowledge in many domains. While improving these models traditionally relies on costly human data, recent self-rewarding mechanisms (Yuan et al., 2024) have shown that LLMs can improve by judging their own responses instead of relying on human labelers. However, existing methods have primarily focused on improving model responses rather than judgment capabilities, resulting in rapid saturation during iterative training. To address this issue, we introduce a novel Meta-Rewarding step to the self-improvement process, where the model judges its own judgements and uses that feedback to refine its judgment skills. Surprisingly, this unsupervised approach improves the model’s ability to judge {\em and} follow instructions, as demonstrated by a win rate improvement of Llama-3-8B-Instruct from 22.9% to 39.4% on AlpacaEval 2, and 20.6% to 29.1% on Arena-Hard. These results strongly suggest the potential for self-improving models without human supervision.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/55bc2e803daac9fb.png&quot; alt=&quot;Large Language Models (LLMs) are rapidly&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3.) Gemma 2: Improving Open Language Models at a Practical Size( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In this work, we introduce Gemma 2, a new addition to the Gemma family of lightweight, state-of-the-art open models, ranging in scale from 2 billion to 27 billion parameters. In this new version, we apply several known technical modifications to the Transformer architecture, such as interleaving local-global attentions (Beltagy et al., 2020a) and group-query attention (Ainslie et al., 2023). We also train the 2B and 9B models with knowledge distillation (Hinton et al., 2015) instead of next token prediction. The resulting models deliver the best performance for their size, and even offer competitive alternatives to models that are 2-3 times bigger. We release all our models to the community.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/d3ea31aa6e58ba8e.jpg&quot; alt=&quot;In this work, we introduce Gemma 2, a ne&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4.) SF3D: Stable Fast 3D Mesh Reconstruction with UV-unwrapping and Illumination Disentanglement ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We present SF3D, a novel method for rapid and high-quality textured object mesh reconstruction from a single image in just 0.5 seconds. Unlike most existing approaches, SF3D is explicitly trained for mesh generation, incorporating a fast UV unwrapping technique that enables swift texture generation rather than relying on vertex colors. The method also learns to predict material parameters and normal maps to enhance the visual quality of the reconstructed 3D meshes. Furthermore, SF3D integrates a delighting step to effectively remove low-frequency illumination effects, ensuring that the reconstructed meshes can be easily used in novel illumination conditions.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/def25eece0bdae58.png&quot; alt=&quot;We present SF3D, a novel method for rapi&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5.) MindSearch: Mimicking Human Minds Elicits Deep AI Searcher ( webpage | paper | demo )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Information seeking and integration is a complex cognitive task that consumes enormous time and effort. Inspired by the remarkable progress of Large Language Models, recent works attempt to solve this task by combining LLMs and search engines. However, these methods still obtain unsatisfying performance due to three challenges: (1) complex requests often cannot be accurately and completely retrieved by the search engine once (2) corresponding information to be integrated is spread over multiple web pages along with massive noise, and (3) a large number of web pages with long contents may quickly exceed the maximum context length of LLMs. Inspired by the cognitive process when humans solve these problems, we introduce MindSearch to mimic the human minds in web information seeking and integration, which can be instantiated by a simple yet effective LLM-based multi-agent framework.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/59761b3820b708f3.png&quot; alt=&quot;Information seeking and integration is a&quot;&gt;&lt;/p&gt;
&lt;p&gt;6.) &lt;strong&gt;Tora: Trajectory-oriented Diffusion Transformer for Video Generation(webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Recent advancements in Diffusion Transformer (DiT) have demonstrated remarkable proficiency in producing high-quality video content. Nonetheless, the potential of transformer-based diffusion models for effectively generating videos with controllable motion remains an area of limited exploration. This paper introduces Tora, the first trajectory-oriented DiT framework that integrates textual, visual, and trajectory conditions concurrently for video generation.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/64455970df8e7049.png&quot; alt=&quot;Recent advancements in Diffusion Transfo&quot;&gt;&lt;/p&gt;
&lt;p&gt;7.) &lt;strong&gt;How to Choose a Reinforcement-Learning Algorithm ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The field of reinforcement learning offers a large variety of concepts and methods to tackle sequential decision-making problems. This variety has become so large that choosing an algorithm for a task at hand can be challenging. In this work, we streamline the process of choosing reinforcement-learning algorithms and action-distribution families. We provide a structured overview of existing methods and their properties, as well as guidelines for when to choose which methods.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/efee0c2a7f6218a4.jpg&quot; alt=&quot;The field of reinforcement learning offe&quot;&gt;&lt;/p&gt;
&lt;p&gt;8.) &lt;strong&gt;SAM 2: Segment Anything in Images and Videos ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We present Segment Anything Model 2 (SAM 2), a foundation model towards solving promptable visual segmentation in images and videos. We build a data engine, which improves model and data via user interaction, to collect the largest video segmentation dataset to date. Our model is a simple transformer architecture with streaming memory for real-time video processing. SAM 2 trained on our data provides strong performance across a wide range of tasks. In video segmentation, we observe better accuracy, using 3x fewer interactions than prior approaches. In image segmentation, our model is more accurate and 6x faster than the Segment Anything Model (SAM). We believe that our data, model, and insights will serve as a significant milestone for video segmentation and related perception tasks. We are releasing a version of our model, the dataset and an interactive demo.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/0e1ee64070c74fd6.png&quot; alt=&quot;We present Segment Anything Model 2 (SAM&quot;&gt;&lt;/p&gt;
&lt;p&gt;9.) &lt;strong&gt;Machine Unlearning in Generative AI: A Survey ( paper | repo )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Generative AI technologies have been deployed in many places, such as (multimodal) large language models and vision generative models. Their remarkable performance should be attributed to massive training data and emergent reasoning abilities. However, the models would memorize and generate sensitive, biased, or dangerous information originated from the training data especially those from web crawl. New machine unlearning (MU) techniques are being developed to reduce or eliminate undesirable knowledge and its effects from the models, because those that were designed for traditional classification tasks could not be applied for Generative AI. We offer a comprehensive survey on many things about MU in Generative AI, such as a new problem formulation, evaluation methods, and a structured discussion on the advantages and limitations of different kinds of MU techniques. It also presents several critical challenges and promising directions in MU research.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c82b5924e504bca3.jpg&quot; alt=&quot;Generative AI technologies have been dep&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;10.) The Art of Refusal: A Survey of Abstention in Large Language Models ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Abstention, the refusal of large language models (LLMs) to provide an answer, is increasingly recognized for its potential to mitigate hallucinations and enhance safety in building LLM systems. In this survey, we introduce a framework to examine abstention behavior from three perspectives: the query, the model, and human values. We review the literature on abstention methods (categorized based on the development stages of LLMs), benchmarks, and evaluation metrics, and discuss the merits and limitations of prior work. We further identify and motivate areas for future research, such as encouraging the study of abstention as a meta-capability across tasks and customizing abstention abilities based on context. In doing so, we aim to broaden the scope and impact of abstention methodologies in AI systems.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/db801f99a10d1616.jpg&quot; alt=&quot;Abstention, the refusal of large languag&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;aigc-news-of-the-weekjuly-29---august-04&quot;&gt;AIGC News of the week（July 29 - August 04）&lt;/h3&gt;
&lt;p&gt;1.) FLUX.1: A new era of creation ( webpage | model | repo )&lt;/p&gt;
&lt;p&gt;The best of FLUX.1, offering state-of-the-art performance image generation with top of the line prompt following, visual quality, image detail and output diversity.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/cac89182ca3e907b.jpg&quot; alt=&quot;The best of FLUX.1, offering state of th&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) ComfyUI-segment-anything-2 ( repo )&lt;/p&gt;
&lt;p&gt;3.) nano-llama31: nanoGPT style version of Llama 3.1 ( repo )&lt;/p&gt;
&lt;p&gt;4.) tiny-tpu: A minimal Tensor Processing Unit (TPU) inspired by Google’s TPUv1 ( repo)&lt;/p&gt;
&lt;p&gt;5.) Awesome 3D Gaussian Splatting Resources ( repo )&lt;/p&gt;
&lt;p&gt;Newsletter链接：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-79&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-79&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;更多AIGC News: AINews&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://ainews.kol.tools/&quot;&gt;https://ainews.kol.tools/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;欢迎关注我，也期待你和我的更多互动。&lt;/p&gt;</content:encoded><category>AIGC</category><category>AIGC Weekly</category><category>AI论文</category></item><item><title>AIGC 周刊 第78期</title><link>https://pxiaoer.blog/posts/2024/aigc-%E5%91%A8%E5%88%8A-%E7%AC%AC78%E6%9C%9F/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/aigc-%E5%91%A8%E5%88%8A-%E7%AC%AC78%E6%9C%9F/</guid><description>AIGC Weekly | #78 （July 22 - July 28）</description><pubDate>Mon, 29 Jul 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/cc5f65662b963b2a.png&quot; alt=&quot;写在前面&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;&quot;&gt;&lt;/h1&gt;
&lt;h1 id=&quot;写在前面&quot;&gt;写在前面&lt;/h1&gt;
&lt;p&gt;今年元旦的时候，向大家介绍过我的&lt;a href=&quot;http://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126362&amp;#x26;idx=1&amp;#x26;sn=f4dbb15c9bb50f065ccd09ca6c8985b4&amp;#x26;chksm=80af3e70b7d8b7661b7b1eac0bfeed5efb8c2df9b2f44823751a87b3b03f175f04ff9d325854&amp;#x26;scene=21#wechat_redirect&quot;&gt;AIGC Newsletter&lt;/a&gt;，今天觉得这个每周的AIGC周刊还是应该同步到公众号上，方便大家阅读。另外公众号开始重新更新一些技术相关的内容，也算是保持写作与思考的一种方式。&lt;/p&gt;
&lt;p&gt;因为公众号无法做链接跳转，如果想阅读方便一些，可以直接复制链接跳转到网页上阅读，也可以用邮件订阅我的Newsletter，周刊每周一更新。&lt;/p&gt;
&lt;p&gt;&lt;em&gt;本周AIGC周刊链接&lt;/em&gt;：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-78&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-78&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h1 id=&quot;aigc-weekly--78&quot;&gt;AIGC Weekly | #78&lt;/h1&gt;
&lt;h3 id=&quot;-1&quot;&gt;&lt;/h3&gt;
&lt;h3 id=&quot;top-papers-of-the-weekjuly-22---july-28&quot;&gt;Top Papers of the week（July 22 - July 28）&lt;/h3&gt;
&lt;h3 id=&quot;-2&quot;&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;1.) Introducing Llama 3.1: Our most capable models to date ( webpage | paper | model | repo )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Llama 3.1 405B is the first openly available model that rivals the top AI models when it comes to state-of-the-art capabilities in general knowledge, steerability, math, tool use, and multilingual translation. With the release of the 405B model, we’re poised to supercharge innovation—with unprecedented opportunities for growth and exploration. We believe the latest generation of Llama will ignite new applications and modeling paradigms, including synthetic data generation to enable the improvement and training of smaller models, as well as model distillation—a capability that has never been achieved at this scale in open source.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/46224b080eff4e88.png&quot; alt=&quot;Llama 3.1 405B is the first openly avail&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2.) Mistral Large 2 ( webpage | model )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;we are announcing Mistral Large 2, the new generation of our flagship model. Compared to its predecessor, Mistral Large 2 is significantly more capable in code generation, mathematics, and reasoning. It also provides a much stronger multilingual support, and advanced function calling capabilities.&lt;/p&gt;
&lt;p&gt;Mistral Large 2 has a 128k context window and supports dozens of languages including French, German, Spanish, Italian, Portuguese, Arabic, Hindi, Russian, Chinese, Japanese, and Korean, along with 80+ coding languages including Python, Java, C, C++, JavaScript, and Bash.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/ed5ac10ce7b3cb4a.png&quot; alt=&quot;Mistral Large 2 has a 128k context windo&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3.) AI achieves silver-medal standard solving International Mathematical Olympiad problems ( webpage )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;we present AlphaProof, a new reinforcement-learning based system for formal math reasoning, and AlphaGeometry 2, an improved version of our geometry-solving system. Together, these systems solved four out of six problems from this year’s International Mathematical Olympiad (IMO), achieving the same level as a silver medalist in the competition for the first time.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/9f78d852e7dec2cf.jpg&quot; alt=&quot;we present AlphaProof, a new reinforceme&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4.) Imagine yourself: Tuning-Free Personalized Image Generation ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Diffusion models have demonstrated remarkable efficacy across various image-to-image tasks. In this research, we introduce Imagine yourself, a state-of-the-art model designed for personalized image generation. Unlike conventional tuning-based personalization techniques, Imagine yourself operates as a tuning-free model, enabling all users to leverage a shared framework without individualized adjustments. Moreover, previous work met challenges balancing identity preservation, following complex prompts and preserving good visual quality, resulting in models having strong copy-paste effect of the reference images. Thus, they can hardly generate images following prompts that require significant changes to the reference image, e.g., changing facial expression, head and body poses, and the diversity of the generated images is low.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/200a1e68f6fd3df4.jpg&quot; alt=&quot;Diffusion models have demonstrated remar&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5.) Stretching Each Dollar: Diffusion Training from Scratch on a Micro-Budget (paper)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As scaling laws in generative AI push performance, they also simultaneously concentrate the development of these models among actors with large computational resources. With a focus on text-to-image (T2I) generative models, we aim to address this bottleneck by demonstrating very low-cost training of large-scale T2I diffusion transformer models. As the computational cost of transformers increases with the number of patches in each image, we propose to randomly mask up to 75% of the image patches during training. We propose a deferred masking strategy that preprocesses all patches using a patch-mixer before masking, thus significantly reducing the performance degradation with masking, making it superior to model downscaling in reducing computational cost. We also incorporate the latest improvements in transformer architecture, such as the use of mixture-of-experts layers, to improve performance and further identify the critical benefit of using synthetic images in micro-budget training. Finally, using only 37M publicly available real and synthetic images, we train a 1.16 billion parameter sparse transformer with only $1,890 economical cost and achieve a 12.7 FID in zero-shot generation on the COCO dataset.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/199214581b69f67a.jpg&quot; alt=&quot;As scaling laws in generative AI push pe&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6.) LazyLLM: Dynamic Token Pruning for Efficient Long Context LLM Inference ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The inference of transformer-based large language models consists of two sequential stages: 1) a prefilling stage to compute the KV cache of prompts and generate the first token, and 2) a decoding stage to generate subsequent tokens. For long prompts, the KV cache must be computed for all tokens during the prefilling stage, which can significantly increase the time needed to generate the first token. Consequently, the prefilling stage may become a bottleneck in the generation process. An open question remains whether all prompt tokens are essential for generating the first token. To answer this, we introduce a novel method, LazyLLM, that selectively computes the KV for tokens important for the next token prediction in both the prefilling and decoding stages. Contrary to static pruning approaches that prune the prompt at once, LazyLLM allows language models to dynamically select different subsets of tokens from the context in different generation steps, even though they might be pruned in previous steps. Extensive experiments on standard datasets across various tasks demonstrate that LazyLLM is a generic method that can be seamlessly integrated with existing language models to significantly accelerate the generation without fine-tuning.For instance, in the multi-document question-answering task, LazyLLM accelerates the prefilling stage of the LLama 2 7B model by 2.34x while maintaining accuracy.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/89feeb6dc0a8138a.png&quot; alt=&quot;The inference of transformer based large&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;7.) OutfitAnyone: Ultra-high Quality Virtual Try-On for Any Clothing and Any Person ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Virtual Try-On (VTON) has become a transformative technology, empowering users to experiment with fashion without ever having to physically try on clothing. However, existing methods often struggle with generating high-fidelity and detail-consistent results. While diffusion models, such as Stable Diffusion series, have shown their capability in creating high-quality and photorealistic images, they encounter formidable challenges in conditional generation scenarios like VTON. Specifically, these models struggle to maintain a balance between control and consistency when generating images for virtual clothing trials. OutfitAnyone addresses these limitations by leveraging a two-stream conditional diffusion model, enabling it to adeptly handle garment deformation for more lifelike results. It distinguishes itself with scalability-modulating factors such as pose, body shape and broad applicability, extending from anime to in-the-wild images.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c065d73de40c7b50.jpg&quot; alt=&quot;Virtual Try On (VTON) has become a trans&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;8.) SV4D: Dynamic 3D Content Generation with Multi-Frame and Multi-View Consistency ( webpage | paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We present Stable Video 4D (SV4D), a latent video diffusion model for multi-frame and multi-view consistent dynamic 3D content generation. Unlike previous methods that rely on separately trained generative models for video generation and novel view synthesis, we design a unified diffusion model to generate novel view videos of dynamic 3D objects. Specifically, given a monocular reference video, SV4D generates novel views for each video frame that are temporally consistent. We then use the generated novel view videos to optimize an implicit 4D representation (dynamic NeRF) efficiently, without the need for cumbersome SDS-based optimization used in most prior works. To train our unified novel view video generation model, we curated a dynamic 3D object dataset from the existing Objaverse dataset. Extensive experimental results on multiple datasets and user studies demonstrate SV4D’s state-of-the-art performance on novel-view video synthesis as well as 4D generation compared to prior works.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/192c1ea00e5662a1.png&quot; alt=&quot;We present Stable Video 4D (SV4D), a lat&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;9.) OpenDevin: An Open Platform for AI Software Developers as Generalist Agents ( paper | repo | benchmark )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Software is one of the most powerful tools that we humans have at our disposal; it allows a skilled programmer to interact with the world in complex and profound ways. At the same time, thanks to improvements in large language models (LLMs), there has also been a rapid development in AI agents that interact with and affect change in their surrounding environments. In this paper, we introduce OpenDevin, a platform for the development of powerful and flexible AI agents that interact with the world in similar ways to those of a human developer: by writing code, interacting with a command line, and browsing the web. We describe how the platform allows for the implementation of new agents, safe interaction with sandboxed environments for code execution, coordination between multiple agents, and incorporation of evaluation benchmarks.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/7e0049cd85906108.png&quot; alt=&quot;Software is one of the most powerful too&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;10.) A Comprehensive Survey of LLM Alignment Techniques: RLHF, RLAIF, PPO, DPO and More ( paper )&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With advancements in self-supervised learning, the availability of trillions tokens in a pre-training corpus, instruction fine-tuning, and the development of large Transformers with billions of parameters, large language models (LLMs) are now capable of generating factual and coherent responses to human queries. However, the mixed quality of training data can lead to the generation of undesired responses, presenting a significant challenge. Over the past two years, various methods have been proposed from different perspectives to enhance LLMs, particularly in aligning them with human expectation. Despite these efforts, there has not been a comprehensive survey paper that categorizes and details these approaches. In this work, we aim to address this gap by categorizing these papers into distinct topics and providing detailed explanations of each alignment method, thereby helping readers gain a thorough understanding of the current state of the field.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/14e4a74da88b973d.png&quot; alt=&quot;With advancements in self supervised lea&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;-3&quot;&gt;&lt;/h3&gt;
&lt;h3 id=&quot;aigc-news-of-the-weekjuly-22---july-28&quot;&gt;AIGC News of the week（July 22 - July 28）&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;) Building A Generative AI Platform by Chip Huyen ( link )&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/bc217b5316105442.jpg&quot; alt=&quot;) Building A Generative AI Platform by C&quot;&gt;&lt;/p&gt;
&lt;p&gt;2.) Audio-Synchronized Visual Animation ( repo )&lt;/p&gt;
&lt;p&gt;3.) pptx2md: a pptx to markdown converter ( repo )&lt;/p&gt;
&lt;p&gt;4.) ktransformers: a Flexible Framework for Experiencing Cutting-edge LLM Inference Optimizations ( repo )&lt;/p&gt;
&lt;p&gt;5.) AI Video Generator Runway Trained on Thousands of YouTube Videos Without Permission ( link )&lt;/p&gt;
&lt;p&gt;Newsletter链接：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://aigc.openbot.ai/p/aigc-weekly-78&quot;&gt;https://aigc.openbot.ai/p/aigc-weekly-78&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;更多AIGC News: AINews&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://ainews.kol.tools/&quot;&gt;https://ainews.kol.tools/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;欢迎关注我，也期待你和我的更多互动。&lt;/p&gt;</content:encoded><category>AIGC</category><category>AIGC Weekly</category><category>AI论文</category></item><item><title>新年好，给大家介绍一下我的AIGC newsletter</title><link>https://pxiaoer.blog/posts/2024/%E6%96%B0%E5%B9%B4%E5%A5%BD%E7%BB%99%E5%A4%A7%E5%AE%B6%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%8B%E6%88%91%E7%9A%84aigc-newsletter/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2024/%E6%96%B0%E5%B9%B4%E5%A5%BD%E7%BB%99%E5%A4%A7%E5%AE%B6%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%8B%E6%88%91%E7%9A%84aigc-newsletter/</guid><description>2024年，不要慌，问题不大。先介绍一下我已经做了一个多月的AIGC&apos;s newsletter</description><pubDate>Mon, 01 Jan 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;朋友们，新年好呀！&lt;/p&gt;
&lt;p&gt;今天主要就是来介绍我的这个AIGC相关的newsletter，先直接放链接。&lt;/p&gt;
&lt;p&gt;官网是：&lt;a href=&quot;https://aigc.openbot.ai&quot;&gt;https://aigc.openbot.ai&lt;/a&gt;  点击最后原文链接也可跳转&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/af7e17dbbb995932.png&quot; alt=&quot;官网是： 点击最后原文链接也可跳转&quot;&gt;&lt;/p&gt;
&lt;p&gt;AIGC newsletter主要有三个栏目：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;AIGC DAILY PAPERS：每日最新论文和新闻，周一到周五发布。目前已发20+篇。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AIGC Article：AIGC深度实践文章，涉及世界模型，RAG，Agent等领域，每周1到2篇，2024年开始更新。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h1 id=&quot;aigc-weeklyaigc周刊每周一发布总结上一周最新最重要的论文和项目目前已发47期&quot;&gt;AIGC Weekly：AIGC周刊，每周一发布，总结上一周最新最重要的论文和项目。目前已发47期。&lt;/h1&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;目前newsletter的每日最新论文和AIGC周刊都是免费的，只要填写邮箱地址就可以每天收到文章，AIGC深度文章只供付费会员，也欢迎大家付费订阅。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;为什么会有这个newsletter&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;主要是因为我在小红书上有个每天发最新论文的账号，目前已经有5000多粉丝，但是小红书并不能放链接，还有一些审核过不了，非常不方便，很多人要求搞个在线的，具体如下：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/7e3ba36755530aa4.jpg&quot; alt=&quot;主要是因为我在小红书上有个每天发最新论文的账号，目前已经有5000多粉丝，但是小&quot;&gt;&lt;/p&gt;
&lt;p&gt;自己做的AK账号Daily Papers爬取：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/a6f578f92a002305.png&quot; alt=&quot;自己做的AK账号Daily Papers爬取&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;这个newsletter的未来规划&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;我读论文也是因为觉得这个阶段非常需要，所以自动化做了不少的东西。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c0e483779f7528da.png&quot; alt=&quot;我读论文也是因为觉得这个阶段非常需要，所以自动化做了不少的东西。&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/b7c6b868469b2909.png&quot; alt=&quot;我读论文也是因为觉得这个阶段非常需要，所以自动化做了不少的东西。&quot;&gt;&lt;/p&gt;
&lt;p&gt;未来，肯定会继续自动优化这个newsletter，说不定还会做一个产品出来。然后就是写一些AIGC相关的实践文章，我把2024年定义为实践分享年，主要领域包括SD，世界模型，Agent，RAG等。&lt;/p&gt;
&lt;p&gt;也欢迎大家找我私聊，微信：pxiaoer2025&lt;/p&gt;
&lt;p&gt;对这个newsletter有兴趣的朋友，可以去&lt;a href=&quot;https://aigc.openbot.ai&quot;&gt;https://aigc.openbot.ai&lt;/a&gt; 看看，免费订阅一个。目前论文还接受投稿，网站上能找到提交链接。&lt;/p&gt;</content:encoded><category>公众号</category><category>P小二</category></item><item><title>16.DPU网络开发SDK——DPDK(十五)</title><link>https://pxiaoer.blog/posts/2023/16dpu%E7%BD%91%E7%BB%9C%E5%BC%80%E5%8F%91sdkdpdk%E5%8D%81%E4%BA%94/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2023/16dpu%E7%BD%91%E7%BB%9C%E5%BC%80%E5%8F%91sdkdpdk%E5%8D%81%E4%BA%94/</guid><description>DPU网络开发SDK——DPDK(十五)</description><pubDate>Sat, 11 Nov 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;前面我们介绍了ethtool初始化网卡过程中涉及到的重要函数以及背后的实现原理，接下来我们介绍该例子中剩下的一些DPDK函数的底层实现，这些函数在编写DPDK应用时经常被使用到。&lt;/p&gt;
&lt;p&gt;rte_lcore_count()&lt;/p&gt;
&lt;p&gt;在前面的文章中我们提到DPDK有两个全局的变量，其中一个类型为struct rte_config，获取方式为调用rte_eal_get_configuration()，rte_lcore_count()则是返回其中lcore_count成员中的值。该值是在init()过程的第7步中被设置的。&lt;/p&gt;
&lt;p&gt;rte_lcore_id()&lt;/p&gt;
&lt;p&gt;该func的实现是通过宏定义RTE_PER_LCORE(_lcore_id)读取一个变量，该宏的定义为&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;#define RTE_PER_LCORE(name) (per_lcore_&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;##name)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;其读取的是一个per-lcore的变量，变量的定义方法为&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;#define RTE_DEFINE_PER_LCORE(type, name)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;          \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    __thread __typeof__(type) per_lcore_&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;##nameRTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;而对_lcore_id这个per-lcore设置的位置在eal_thread_loop()，在init()过程的第30步中我们提到，该func是所有worker lcore的入口，也是在该func中执行用户自定义函数的，在执行用户自定义函数前，将_lcore_id等per-lcore变量提前设置好，方便之后的调用。&lt;/p&gt;
&lt;p&gt;rte_eal_remote_launch()&lt;/p&gt;
&lt;p&gt;该func在init()过程中第9节已经介绍过。&lt;/p&gt;
&lt;p&gt;rte_eal_wait_lcore()&lt;/p&gt;
&lt;p&gt;该func就是检查lcore_config[lcore_id].state的状态，当状态不是WAIT且不是FINISHED时，进入rte_pause()，rte_pause()通过C语言内联汇编实现。&lt;/p&gt;
&lt;p&gt;对于网络数据包处理程序，用户自定义函数通常是个死循环，即无限期对数据包进行处理，故在此类应用中，rte_eal_wait_lcore()永远不会发生返回。&lt;/p&gt;
&lt;p&gt;rte_spinlock_trylock() / rte_spinlock_unlock()&lt;/p&gt;
&lt;p&gt;自旋锁是操作系统内核当中的一个概念，由于DPDK是用户态的，故在用户态实现自旋锁是通过C语言内联汇编实现的，该内容比较复杂，在此先不做讨论。&lt;/p&gt;
&lt;p&gt;rte_eth_rx_burst()&lt;/p&gt;
&lt;p&gt;该func是收包的基本入口函数，需要重点分析。&lt;/p&gt;
&lt;p&gt;通过传入的port_id，在数组rte_eth_devices中找到对应的网卡对象，并调用dev-&gt;rx_pkt_burst。rx_pkt_burst具体指向哪个处理函数，是在第14节中提到的ixgbe_dev_start()中的ixgbe_dev_rx_init()-&gt;ixgbe_set_rx_function()中设置的。针对ixgbe类型的设备而言，可选的处理函数非常多，需要根据dev-&gt;data-&gt;dev_private指向的ixgbe_adaptor中的特性决定。此项内容相对复杂，涉及到众多硬件特性，今后有机会将单独做介绍，在此我们以ixgbe_recv_pkts()为例进行分析。&lt;/p&gt;
&lt;p&gt;ixgbe_recv_pkts()可以一次收取最多nb_pkts个数据包，但在向底层获取数据包时，仍然是一个一个获取的。接收之前，需要获取到rx_queues[queue_id]-&gt;rx_ring这个接收队列，及rx_queues[queue_id]-&gt;sw_ring这个软件队列。首先调用rte_mbuf_raw_alloc()分配一块内存nmb，这块内存是用于存数据包的数据的；分配好之后调用rte_ixgbe_prefetch()读取到实际的数据，此时读取到的包是写入到sw_ring[idx+1]中的，也就是说是先预读取下一个数据包；下一个数据包读取数据完毕后，将nmb存入sw_ring[idx]中，将sw_ring[idx]原本指向的内容赋值给rxm进行进一步处理；接下来设置rxm中数据包长度，数据包数据部分长度，数据包类型，哈希情况相关的一些字段，即可以看作是对数据包的分析过程。最后将rxm作为结果返回。&lt;/p&gt;
&lt;p&gt;从过程中可以看出，在某一次数据包接收处理时，仅对数据包进行分析，读取动作则针对的是下一个要接收的数据包，而本次处理的数据包，是在上一个数据包的处理过程中就读取好了。在这里sw_ring元素作为一个管理数据包存储空间的入口点，目的是为了实现数据包的一个预读取，而rx_ring元素则是存储预读取数据包的一些基本信息。预读取的实现是通过内联汇编实现的，实现直接对cache缓存的一个读取。&lt;/p&gt;
&lt;p&gt;rte_eth_tx_burst()&lt;/p&gt;
&lt;p&gt;同上，该func是发包的基本入口函数，实际调用dev-&gt;tx_pkt_burst。dev-&gt;tx_pkt_burst具体指向的处理函数是在ixgbe_dev_tx_queue_setup()-&gt;ixgbe_set_tx_function()中设置(第14节有介绍)，相比rx，tx可选的处理函数少，我们以ixgbe_xmit_pkts()为例进行分析。&lt;/p&gt;
&lt;p&gt;ixgbe_xmit_pkts()同样一次可以发送多个数据包。发送之前，需要获取到tx_queues[queue_id]-&gt;tx_ring这个接收队列，以及tx_queues[queue_id]-&gt;sw_ring这个软件队列。首先需要检查一下tx_queues[queue_id]中统计的空闲空间数量，如果数量不足，则调用ixgbe_xmit_cleanup()释放一部分空间。&lt;/p&gt;
&lt;p&gt;在ixgbe_xmit_cleanup()中，首先计算出需要释放掉的最后一个描述符索引desc_to_clean_to，该值默认为上一次的释放描述符索引last_desc_cleaned+tx重置门限tx_rs_thresh，如果加和之后desc_to_clean_to大于当前队列中描述符的数量nb_tx_desc，则从desc_to_clean_to中减去nb_tx_desc。&lt;/p&gt;
&lt;p&gt;接下来根据desc_to_clean_to，找到sw_ring[desc_to_clean_to]在tx_ring中对应的描述符，确认该描述符的状态是否已完成，如果未完成则不可继续释放。接下来确定要释放掉的描述符的数量nb_tx_to_clean，即根据上一次释放的描述符索引last_desc_cleaned与需要释放掉的最后一个描述符索引desc_to_clean_to之间的差值进行计算，同时要考虑这两个索引的前后关系，确保差值不会出现负值。最后将nb_tx_to_clean直接加到tx_queues[queue_id]中统计的空闲空间数量nb_tx_free中，并更新tx_queues[queue_id]中last_desc_cleaned的值。从整个释放过程可以看出，释放描述符的过程是通过更改tx_queues[queue_id]记录的空闲描述符的的起始位置，数量等内容来实现的。&lt;/p&gt;
&lt;p&gt;接下来就开始依次遍历要发送的数据包并发送了，对于每一个数据包tx_pkt，检查其中的标志位tx_pkt-&gt;ol_flags，判断是否开启offload，如果开启，则填充数据结构union ixgbe_tx_offload，主要填充的内容是数据包二、三、四层的大小，vlan，外层封装的二、三层大小等，最后根据offload信息，获取到一个上下文对象ctx，这个ctx对象可能是需要重建的，具体由标志位new_ctx标识。&lt;/p&gt;
&lt;p&gt;接下来需要计算发送这个数据包需要的描述符数量nb_used，该值由数据包的段的数量tx_pkt-&gt;nb_segs决定，如果ctx需要一个新的(即new_ctx为true)，则额外再增加一个。当nb_used的数量+队列已使用描述符数量nb_tx_used超过tx重置门限时，需要把上一次处理的最后一个tx_ring描述符txp的read.cmd_type_len中标识重置操作的标志位置位。&lt;/p&gt;
&lt;p&gt;发送一个数据包所需要分配的描述符数量必须等于数据包的段数量，如果存在需要新的上下文对象的情况则再加1，据此决定要发送该数据包并为该数据包分配sw_ring中的描述符之后，最后一个描述符的索引tx_last(注意描述符是环状结构，需要处理回环的情况)为多少。&lt;/p&gt;
&lt;p&gt;当所需要的描述符数量nb_used大于nb_tx_free时，则需要调用ixgbe_xmit_cleanup()释放部分描述符，当释放过程失败时，则直接终止所有包的发送过程，直接结束ixgbe_xmit_pkts()。释放过程正常结束之后，如果nb_tx_free仍然大于nb_tx_free，则多次调用ixgbe_xmit_cleanup()来释放描述符，直到nb_tx_free不再大于nb_tx_free为止；如果某次释放过程发生错误，则同样直接终止所有包的发送过程。&lt;/p&gt;
&lt;p&gt;接下来如果该数据包开启了offload，且new_ctx为true，则调用ixgbe_set_xmit_ctx()设置tx_ring中第一个空闲的描述符(即索引为tx_queues[queue_id]-&gt;tx_tail描述符，并强行转换为struct ixgbe_adv_tx_context_desc类型)，此外这里会消耗一个sw_ring中的元素。&lt;/p&gt;
&lt;p&gt;接下来是循环处理数据包的中的段，每一个段的mbuf被赋值到sw_ring的元素，而每一sw_ring元素在tx_ring中对应的元素则存入段指向的内存空间的DMA地址，offload信息等。在处理当前的sw_ring元素txe时，会根据txe-&gt;next_id获取到下一个sw_ring元素txn，这里txn不仅要在循环末期赋值给txe用于下一次段处理，而且需要执行预发送操作(通过rte_prefetch0)，这里和收包过程中的预读取是相同的，是为了刷新cache line。每个段处理完成之后，更新tx_queues[queue_id]中nb_tx_used和nb_tx_free的数量，如果更新nb_tx_used之后其值大于等于tx重置门限，则将重置标志位写于当前最后一个tx_ring描述符的read.cmd_type_len中，如果nb_tx_used没有超过tx重置门限，则只记录下本次处理的最后一个tx_ring描述符到txp当中，该变量在下一个数据包处理过程中可能会用到。&lt;/p&gt;
&lt;p&gt;以上就是DPDK中最重要的两个过程发送数据包和接收数据包过程的分析，从ixgbe代码层面中可以看出，主要的处理过程是借助通过对收发队列中描述符的操作关联相关的mbuf资源，最终操作mbuf发送是通过内嵌的汇编语言进行的。涉及到汇编的操作随着对DPDK的深入了解将详细介绍。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;往期文章：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;http://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126328&amp;#x26;idx=1&amp;#x26;sn=ad7eb7b9d90574152ec438743004cff0&amp;#x26;chksm=80af3e12b7d8b704990c05a2a5a21da0d28d5691203cb0f9fc3a5a5627d6ee4e0bc533e3b266&amp;#x26;scene=21#wechat_redirect&quot;&gt;15.DPU网络开发SDK——DPDK(十四)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;http://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126284&amp;#x26;idx=1&amp;#x26;sn=bf8ddcda9aa34f8d2d1150a5b1673c0f&amp;#x26;chksm=80af3e26b7d8b730618635d3faf64a98d8a040b9dedab599266437e8a983fe7e4cd851b2d1e9&amp;#x26;scene=21#wechat_redirect&quot;&gt;14.DPU网络开发SDK——DPDK(十三)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;http://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126273&amp;#x26;idx=1&amp;#x26;sn=779b4b1ead1195657b60ae3da2cdbf81&amp;#x26;chksm=80af3e2bb7d8b73ddf43634bcedbc08ef07f91650ce813e33939a4858134b6340b5cb30dd9ca&amp;#x26;scene=21#wechat_redirect&quot;&gt;13.DPU网络开发SDK——DPDK(十二)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>DPU</category><category>DPU</category></item><item><title>在mac上跑下一代文生图模型LCM</title><link>https://pxiaoer.blog/posts/2023/%E5%9C%A8mac%E4%B8%8A%E8%B7%91%E4%B8%8B%E4%B8%80%E4%BB%A3%E6%96%87%E7%94%9F%E5%9B%BE%E6%A8%A1%E5%9E%8Blcm/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2023/%E5%9C%A8mac%E4%B8%8A%E8%B7%91%E4%B8%8B%E4%B8%80%E4%BB%A3%E6%96%87%E7%94%9F%E5%9B%BE%E6%A8%A1%E5%9E%8Blcm/</guid><description>你知道下一代文生图模型LCM吗？</description><pubDate>Wed, 01 Nov 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;LCM模型介绍&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Latent Consistency Models(LCM)是受2023年3月份openai的Consistency Models论文启发而来，主要特点是基于Stable Diffusion，但是能比较快的生成图像。LCM只需4到8步，即可获得比较好的图像，SD则需要25到50个步。&lt;/p&gt;
&lt;p&gt;LCM的相关信息如下：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;论文：&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;主页：&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://latent-consistency-models.github.io/&quot;&gt;https://latent-consistency-models.github.io/&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;代码：&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/luosiallen/latent-consistency-model&quot;&gt;https://github.com/luosiallen/latent-consistency-model&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;demo：&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://huggingface.co/spaces/SimianLuo/Latent_Consistency_Model&quot;&gt;https://huggingface.co/spaces/SimianLuo/Latent_Consistency_Model&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;模型：&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://huggingface.co/SimianLuo/LCM_Dreamshaper_v7&quot;&gt;https://huggingface.co/SimianLuo/LCM_Dreamshaper_v7&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;目前LCM非常活跃，发布10多天，对常用的库和UI都支持了，爱好者还开发了一些比较好玩的应用。下图为更新消息：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/c29790bcf4638fee.png&quot; alt=&quot;目前LCM非常活跃，发布10多天，对常用的库和UI都支持了，爱好者还开发了一些比&quot;&gt;&lt;/p&gt;
&lt;p&gt;这次，我会跟踪最新的消息，从论文解读，代码解析开始，写一系列的实战教程。今天这篇是mac安装教程，主要是为了熟悉环境。&lt;/p&gt;
&lt;h2 id=&quot;安装&quot;&gt;安装&lt;/h2&gt;
&lt;p&gt;硬件要求，Mac测试了M1和M2，最好16G内存，8G内存也行，但是速度比较慢。mac系统 最低 macOS 12.3 。&lt;/p&gt;
&lt;p&gt;这次我们使用replicate的这个github项目：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/replicate/latent-consistency-model&quot;&gt;https://github.com/replicate/latent-consistency-model&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;步骤：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;克隆项目&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F69D50&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; clone&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; https://github.com/replicate/latent-consistency-model&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;创建Python3.10以上的环境&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;conda create --name lcm python=3.10conda activate lcm&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;安装项目依赖&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; latent-consistency-modelpip3&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; install&lt;/span&gt;&lt;span style=&quot;color:#6CB6FF&quot;&gt; -r&lt;/span&gt;&lt;span style=&quot;color:#96D0FF&quot;&gt; requirements.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;运行&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code github-dark-dimmed&quot; style=&quot;background-color:#22272e;color:#adbac7; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;export HF_ENDPOINT=https://hf-mirror.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;python main.py \&quot;a cat like a chengdu panda&quot; \--steps 4 --width 512 --height 512&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;注意环境变量HF_ENDPOINT是为了可以科学的从huggingface下载模型。总共有15个文件，SimianLuo/LCM_Dreamshaper_v7模型有 3.44G，需要等待。&lt;/p&gt;
&lt;p&gt;下载如下图：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/559e45241eb19328.png&quot; alt=&quot;下载如下图&quot;&gt;&lt;/p&gt;
&lt;p&gt;下载完后会直接做推理。你运行的时候可以修改传入的参数，包括prompt，steps，width和height等。下图为图片生成过程。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/ef24a0bf94a2904f.png&quot; alt=&quot;下载完后会直接做推理。你运行的时候可以修改传入的参数，包括prompt，step&quot;&gt;&lt;/p&gt;
&lt;p&gt;生成的图片&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/b09044d79858db0a.png&quot; alt=&quot;生成的图片&quot;&gt;&lt;/p&gt;
&lt;p&gt;推理速度非常快&lt;/p&gt;
&lt;p&gt;好了，你已经成功在mac上运行LCM模型了。难点其实是从huggingface下载模型。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;参考链接：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Consistency Models&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2303.01469&quot;&gt;https://arxiv.org/abs/2303.01469&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2310.04378&quot;&gt;https://arxiv.org/abs/2310.04378&lt;/a&gt;&lt;/p&gt;</content:encoded><category>AIGC</category><category>AIGC</category><category>LCM</category></item><item><title>15. DPU网络开发SDK——DPDK(十四)</title><link>https://pxiaoer.blog/posts/2023/15-dpu%E7%BD%91%E7%BB%9C%E5%BC%80%E5%8F%91sdkdpdk%E5%8D%81%E5%9B%9B/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2023/15-dpu%E7%BD%91%E7%BB%9C%E5%BC%80%E5%8F%91sdkdpdk%E5%8D%81%E5%9B%9B/</guid><description>DPU专栏第15篇——DPU网络开发SDK——DPDK(十四)</description><pubDate>Sat, 07 Oct 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;继续接之前的内容分析ethtool，分析setup_ports()中对网卡的初始化操作，包括几个重要的接口函数。&lt;/p&gt;
&lt;p&gt;rte_eth_rx_queue_setup()完成之后是rte_eth_tx_queue_setup()，该func中，首先检查device和queue_id的合法性，然后调用rte_eth_dev_info_get()获取到设备的信息，之后检查传入的tx描述符的数量是否合法，device是否处于忙碌状态，队列是否处于停止状态，只有device不在忙碌状态且队列是通知状态时，才可以继续队列的setup。如果device中tx队列信息不为空的话，先调用dev-&gt;dev_ops-&gt;tx_queue_release()将队列释放，最后调用dev-&gt;dev_ops-&gt;tx_queue_setup()进行队列的初始化。&lt;/p&gt;
&lt;p&gt;在初始化之前，需要对一些配置进行决策。如果传入rte_eth_rx_queue_setup()的tx_conf的值是空的，则读取dev_info中的默认的txconf配置。对tx_conf中的offloads成员需要重点做检查，如果在调用rte_eth_dev_configure()对网卡进行配置时，已经设置了offloading为开启状态，那么这个状态就是对全部队列有效的，就不需要在tx_conf-&gt;offloads中对该队列单独设置卸载了，tx_conf-&gt;offloads中的设置只针对该队列是tx卸载的而不是网卡所有的队列都是tx卸载的情况。针对该队列新添加的offloadings状态要求rte_eth_dev_configure()是没有开启的，也就是说必须是单队列特性，而单网卡offloading特性不能实现某个队列开启了卸载而另外一个没有开启卸载，另外单网卡offloading特性如果在rte_eth_dev_configure()中没有使能，那么任何新添加的队列也不会开启卸载。这些需要在调用tx_queue_setup()之前做好检查工作。&lt;/p&gt;
&lt;p&gt;tx_queue_setup()以ixgbe_dev_tx_queue_setup()为例，该func中，需要确定一些值，如offload是否开启，tx描述符的数量以及tx释放门限tx_free_thresh和tx重置门限tx_rs_thresh，这两个值是用来控制tx描述符上的rs标志的设置的，具体的规则为：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;当tx_rs_thresh个描述符被使用之后，所有tx描述符的rs标志全部置位&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;存储tx描述符的ring结构在以下两种情况下被清理：1. tx_free_thresh个描述符被使用。2. 发送一个包所需的描述符数量比空闲的tx描述符数量多&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;tx_free_thresh和tx_rs_thresh的值可以通过调用func时传入的tx_conf参数指定，未设置时选择默认值(不同设备值不同，ixgbe的默认值均为32)，且设置的值有一定的限制条件。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;两者之和不能超过tx描述符的数量&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;tx_rs_thresh的值必须小于tx描述符数量-2，且不可大于默认值(ixgbe的默认值为32)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;tx_free_thresh的值必须小于tx描述符数量-3&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;tx_rs_thresh不得大于tx_free_thresh&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;tx描述符数量必须是tx_rs_thresh的整数倍&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;如果配置了tx_rs_thresh，那么写回门限wthresh则不能再设置&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;以上提到的值，在创建了struct ixgbe_tx_queue类型的对象txq之后都会赋值给txq对应的成员，tx_free_thresh和tx_rs_thresh的具体作用在后续分析发包时会有相关解释。&lt;/p&gt;
&lt;p&gt;接下来分配txq对象，该结构最终存储在dev-&gt;data-&gt;tx_queues[]数组当中，分配之前首先检查数组中对应的元素如果不为空的话，需要首先调用ixgbe_tx_queue_release()进行释放。&lt;/p&gt;
&lt;p&gt;接下来调用rte_eth_dma_zone_reserve()，在dma区域上分配一块连续的内存，用来存储多个高级tx描述符，这块内存地址赋值给txq-&gt;tx_ring。在这里分配的高级tx描述符数量是固定的，固定为4096，这个数量要设置的足够大，要满足最大的ring的大小的要求，使得在之后的队列初始化调用func的扩缩容操作能够进行。&lt;/p&gt;
&lt;p&gt;接下来将描述符的数量，tx_free_thresh，tx_rs_thresh和三个门限值记录到txq当中，这三个门限值是：预获取门限，主机门限，写回门限。此外还有网卡和队列的ID，offload开启情况，队列的注册ID等，队列注册ID在网卡没有开启sriov时就是队列的ID，否则队列注册ID需要加上网卡的默认队列池的起始队列的ID。最后将类型为struct ixgbe_txq_ops结构赋值给txq-&gt;ops，该结构体包含了一些对队列的操作的func。&lt;/p&gt;
&lt;p&gt;接下来设置队列和硬件相关的内容，硬件相关结构体存储在dev-&gt;data-&gt;data_private当中，类型为struct ixgbe_hw。主要是设置txq中TDT(Transmit Descriptor Tail)寄存器的地址，根据不同的硬件类型寄存器地址读取的方式也不相同。&lt;/p&gt;
&lt;p&gt;接下来分配软件队列txq-&gt;sw_ring，队列中元素类型为struct ixgbe_tx_entry，数量为tx描述符的数量。最后，根据txq中的特性，调用ixgbe_set_tx_function()给网卡设置dev-&gt;tx_pkt_burst()和dev-&gt;tx_pkt_prepare()这两个函数指针，指明网卡发送数据包时的具体方式。有三种发送方式：分别是ixgbe_xmit_pkts_simple()，ixgbe_xmit_pkts_vec()和ixgbe_xmit_pkts()。具体使用哪种方式，与txq的特性相关。在没有开启offload，且tx_rs_thresh不小于RTE_PMD_IXGBE_TX_MAX_BURST(默认为32)时，使用ixgbe_xmit_pkts_simple()，在此基础上开启了vector TX的话(ixgbe开启条件严格，一般不会用到)，使用ixgbe_xmit_pkts_vec()，除此之外的情况，使用ixgbe_xmit_pkts()，具体发送行为在分析包发送阶段相关内容时再做分析。&lt;/p&gt;
&lt;p&gt;在rx和tx队列初始化完成之后，即可对网卡进行开启处理，调用的接口是rte_eth_dev_start()。在rte_eth_dev_start()中，首先检查dev-&gt;data-&gt;dev_started状态是否正确。接下来如果网卡不支持实时mac地址，则需要将网卡mac地址恢复。之后调用dev-&gt;dev_ops-&gt;dev_start对设备进行开启操作。&lt;/p&gt;
&lt;p&gt;以ixgbe_dev_start()为例，最开始从dev-&gt;data-&gt;dev_private中获取多个配置信息，包括硬件配置信息hw，流量控制信息tm，macsec(media access control security)。接下来调用rte_intr_disable()关闭uio/vfio的中断或者是事件通知文件(eventfd)，调用ixgbe_stop_adaptor()关闭，该func最终调用的是hw-&gt;mac.ops.stop_adaptor()。&lt;/p&gt;
&lt;p&gt;在此我们回顾一下，hw-&gt;mac.ops可以认为是对实际硬件的操作，ops的赋值是在ixgbe_init_ops_X540/82598/82599()进行的，即针对不同型号的网卡分别对ops中的函数指针赋予不同的值；ixgbe_init_ops_generic()可以认为是默认的函数指针，各型号网卡首先赋予ops的函数指针默认值，然后再替换ops中一些特定的函数指针；ops赋值func的调用点在eth_ixgbe_pci_probe()-&gt;eth_ixgbe_dev_init()-&gt;ixgbe_init_shared_code()，eth_ixgbe_pci_probe()我们在第十二节中提到过其调用的位置。在ixgbe驱动中ops.stop_adaptor()被赋值的内容为ixgbe_stop_adapter_generic()，其中的大部分操作都是通过对设备寄存器的读写实现网络适配器的停止，此处涉及较多硬件特性，在此不做特定分析。&lt;/p&gt;
&lt;p&gt;stop_adaptor()之后，便是ixgbe_pf_reset_hw()，以及接下来的hw-&gt;mac.ops.start_hw()，ixgbe_pf_host_configure()和ixgbe_dev_phy_intr_setup()，之后还有大量对寄存器的读写，包含设置offload，硬件回调函数，rx和tx队列，设置链路状态，链路速率，调用rte_intr_enable()开启中断等，都是通过设定寄存器的方式实现对网络适配器的读写，在此一笔带过，我们只需要知道DPDK作为一个用户态的驱动，基本上仿照Linux驱动模型实现的。实际硬件的操作，则是通过读写寄存器的方式进行，由于不同设备硬件的寄存器布局不同，故各设备的驱动理论上都需要单独编写。此处提到的寄存器，则是第十一节提到的bar空间在用户内存空间上的映射，通过对特定内存地址的读写实现对寄存器的读写，具体寄存器在内存空间上的分配，则需要查看各网络设备的手册。&lt;/p&gt;
&lt;p&gt;dev-&gt;dev_ops-&gt;dev_start网卡开启之后，调用eth_dev_config_restore()设置网卡特性，特性是在开启之前调用rte_eth_dev_info_get()获取的，是我们需要网卡配置成的最终状态；由于开启过程中可能将特性重置，所以在开启之后需要对网卡特性重新进行设置。如果设置失败，则需要停止网卡。涉及到的网卡特性包括mac地址，开启/关闭混杂模式，开启/关闭全多播&lt;/p&gt;
&lt;p&gt;最后如果没有开启lsc(link status)中断的话，则需要调用dev-&gt;dev_ops-&gt;link_update()更新链路状态。&lt;/p&gt;
&lt;p&gt;setup_ports()中的最后一个操作是rte_eth_macaddr_get()，直接从dev-&gt;data-&gt;mac_addrs获取mac地址即可。&lt;/p&gt;
&lt;p&gt;至此，ethtool中setup_ports()的主要过程基本分析完毕，后续围绕几个收发包时的func进行分析，未完待续……&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;往期回顾：&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126284&amp;#x26;idx=1&amp;#x26;sn=bf8ddcda9aa34f8d2d1150a5b1673c0f&amp;#x26;chksm=80af3e26b7d8b730618635d3faf64a98d8a040b9dedab599266437e8a983fe7e4cd851b2d1e9&amp;#x26;scene=21#wechat_redirect&quot;&gt;14.DPU网络开发SDK——DPDK(十三)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://mp.weixin.qq.com/s?__biz=MzAwNzc4MDgwNQ==&amp;#x26;mid=2653126273&amp;#x26;idx=1&amp;#x26;sn=779b4b1ead1195657b60ae3da2cdbf81&amp;#x26;chksm=80af3e2bb7d8b73ddf43634bcedbc08ef07f91650ce813e33939a4858134b6340b5cb30dd9ca&amp;#x26;scene=21#wechat_redirect&quot;&gt;13.DPU网络开发SDK——DPDK(十二)&lt;/a&gt;&lt;/p&gt;</content:encoded><category>DPU</category><category>DPU</category></item><item><title>AIGC周刊目录</title><link>https://pxiaoer.blog/posts/2023/aigcweekly/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2023/aigcweekly/</guid><description>AIGC周刊 | 第1期</description><pubDate>Wed, 30 Aug 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;总目录：&lt;a href=&quot;https://aigc.openbot.ai/s/weekly&quot;&gt;AIGC周刊&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/2023/08/image-2.png&quot; alt=&quot;总目录：AIGC周刊&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;目录:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-1&quot;&gt;AIGC周刊 | 第1期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-2&quot;&gt;AIGC周刊 | 第2期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-3&quot;&gt;AIGC周刊 | 第3期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-4&quot;&gt;AIGC周刊 | 第4期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-5&quot;&gt;AIGC周刊 | 第5期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-6&quot;&gt;AIGC周刊 | 第6期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-7&quot;&gt;AIGC周刊 | 第7期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-8&quot;&gt;AIGC周刊 | 第8期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-9&quot;&gt;AIGC周刊 | 第9期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-10&quot;&gt;AIGC周刊 | 第10期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-11&quot;&gt;AIGC周刊 | 第11期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-12&quot;&gt;AIGC周刊 | 第12期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-13&quot;&gt;AIGC周刊 | 第13期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-14&quot;&gt;AIGC周刊 | 第14期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-15&quot;&gt;AIGC周刊 | 第15期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-16&quot;&gt;AIGC周刊 | 第16期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-17&quot;&gt;AIGC周刊 | 第17期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-18&quot;&gt;AIGC周刊 | 第18期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-19&quot;&gt;AIGC周刊 | 第19期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-20&quot;&gt;AIGC周刊 | 第20期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-21&quot;&gt;AIGC周刊 | 第21期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-22&quot;&gt;AIGC周刊 | 第22期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-23&quot;&gt;AIGC周刊 | 第23期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-24&quot;&gt;AIGC周刊 | 第24期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-25&quot;&gt;AIGC周刊 | 第25期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-26&quot;&gt;AIGC周刊 | 第26期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-27&quot;&gt;AIGC周刊 | 第27期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-28&quot;&gt;AIGC周刊 | 第28期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-29&quot;&gt;AIGC周刊 | 第29期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-30&quot;&gt;AIGC周刊 | 第30期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-31&quot;&gt;AIGC周刊 | 第31期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-32&quot;&gt;AIGC周刊 | 第32期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-33&quot;&gt;AIGC周刊 | 第33期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-34&quot;&gt;AIGC周刊 | 第34期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-35&quot;&gt;AIGC周刊 | 第35期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-36&quot;&gt;AIGC周刊 | 第36期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-37&quot;&gt;AIGC周刊 | 第37期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-38&quot;&gt;AIGC周刊 | 第38期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-39&quot;&gt;AIGC周刊 | 第39期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-40&quot;&gt;AIGC周刊 | 第40期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-41&quot;&gt;AIGC周刊 | 第41期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://aigc.substack.com/p/aigc-42&quot;&gt;AIGC周刊 | 第42期&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>AIGC</category><category>AIGC周刊</category></item><item><title>说说，研发工程师这种生物...</title><link>https://pxiaoer.blog/posts/2022/%E8%AF%B4%E8%AF%B4%E7%A0%94%E5%8F%91%E5%B7%A5%E7%A8%8B%E5%B8%88%E8%BF%99%E7%A7%8D%E7%94%9F%E7%89%A9/</link><guid isPermaLink="true">https://pxiaoer.blog/posts/2022/%E8%AF%B4%E8%AF%B4%E7%A0%94%E5%8F%91%E5%B7%A5%E7%A8%8B%E5%B8%88%E8%BF%99%E7%A7%8D%E7%94%9F%E7%89%A9/</guid><description>我让AI画画他眼中的研发工程师，ta给我画了这么一张，我只能说，ta知道自己爸爸们</description><pubDate>Thu, 17 Nov 2022 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://img.pxiaoer.blog/wechat/f8fc8931dab7bab6.png&quot; alt=&quot;我让AI画画他眼中的研发工程师，ta给我画了这么一张，我只能说，ta知道自己爸爸&quot;&gt;&lt;/p&gt;
&lt;p&gt;我让AI画画他眼中的研发工程师，ta给我画了这么一张，我只能说，ta知道自己爸爸们的心情…&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hey 萌友们 晚上好💗 我是萌战&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;我输给p爷这篇文章，约定内容是要赞美研发。原本赢家的意图，应该是想要我写一篇夸夸。&lt;/p&gt;
&lt;p&gt;那,第一个问题是：从何夸起呢？🤔干夸肯定是很无趣的，拉踩好像也不太道德。&lt;/p&gt;
&lt;p&gt;于是我换了个角度想了一下：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;🤔如果这个世界上没有【研发工程师】？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;比如像我这种产品，若是没有【研发工程师】帮我将我的设计变成现实，那这处境该如何形容呢？巧妇难为无米之炊？纸上谈兵的将军？YY大师？嘴炮三千？感觉好像说啥都不为过吧。😓&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;没有研发的产品经理将“百无一用”，&lt;/strong&gt; 不能落地的idea，毫无意义。如果自己不会写代码的话，设计到天花乱坠也就最多只能到高保真demo。&lt;/p&gt;
&lt;p&gt;老实说，只要自己真的想、并且去付诸行动，成为一名产品经理的难度客观来说是低于成为一名研发工程师的。&lt;/p&gt;
&lt;p&gt;研发工程师们，是一群很特别的人。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;🧙♀️真正的魔术师。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;我眼里的研发工程师，&lt;strong&gt;不是&lt;/strong&gt;戏虐文里那些盘踞在&lt;strong&gt;二叉树上的程序猿/车间/实验室里的技术宅&lt;/strong&gt;，&lt;strong&gt;而是施展着属于造物主才能施展的魔法的魔术师&lt;/strong&gt;，无论是软件还是硬件，结构或是电子。&lt;/p&gt;
&lt;p&gt;当这个世界上有任何一件伟大的事物被创造出来的时候，更重要的是想到这个idea的人；还是把idea设计出来的人；或者把设计稿落地的人？&lt;/p&gt;
&lt;p&gt;像这样没有结果（甚至在我看来很无聊）的讨论话题似乎却总是有着一些经久不衰的理由，&lt;strong&gt;但不争的事实是，没有研发工程师这个角色，世界不会拥有这些真实存在的、触手可及的物件。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;所以，无论别人怎么说，我认为研发工程师，才是那个最重要的魔术师。&lt;/strong&gt; 虽然但是，我是个产品人，并且我会一辈子做产品；虽然但是，身为产品，拥有比【研发工程师】更高的话语权是无论如何更舒适的，&lt;strong&gt;我依然由衷这样认为。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;🍳真正的背锅侠&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;刚入行的时候，我对研发的感觉是：哇，他们是公司最酷的一群人。&lt;/p&gt;
&lt;p&gt;当我慢慢长大，我越来越觉得：哇，他们是公司里最苦逼的一群人。&lt;/p&gt;
&lt;p&gt;在大众眼里，产品经理是天生的背锅侠。毕竟，非要说的话，几乎什么都可以挂到产品身上，但是呢，如果产品顶不住压力/ 想丢锅的话，其实也几乎啥都能怪到研发头上。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;某种意义上来说，产品犯的错，研发们通常难免也要一起背。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;（举个🌰：在我一研发朋友所在的公司里，即便是一个产品非要做的伪需求被开发出来，得到了反效果的时候，他们的boss也只会质问研发：为什么没发现产品做的是伪需求。离谱吗？可是，是真的。）&lt;/p&gt;
&lt;p&gt;✨酷炫的职业 vs 🍋苦逼的日常&lt;/p&gt;
&lt;p&gt;一般人眼里，研发的日常是怎样的呢？&lt;/p&gt;
&lt;p&gt;是在一个装满的披萨的冰箱、一台电脑、几箱子啤酒的房间，戴着耳机疯狂码代码的技术天才？还是在办公室里充耳不闻窗外事只盯着屏幕、被打断都要按下“被傻逼打断”的🍅钟的技术宅？&lt;/p&gt;
&lt;p&gt;但其实在大多数公司，他们的真实日常可能是这样的👇🏻：&lt;/p&gt;
&lt;p&gt;“这个功能要做，今天就要。为什么要？你别管，你就管做就行了。”&lt;/p&gt;
&lt;p&gt;“为什么要延期？我看你8点就下班了啊。”&lt;/p&gt;
&lt;p&gt;“客户问我要，你给我弄吧。”&lt;/p&gt;
&lt;p&gt;“X工，客户问那个技术上能不能弄啊，你帮我看一下吧。”&lt;/p&gt;
&lt;p&gt;“X工，这个客户发过来的我看不懂啊，你帮我看一下吧。”&lt;/p&gt;
&lt;p&gt;“我这个客户会议，你来参加一下吧，帮我回答一下技术问题。”&lt;/p&gt;
&lt;p&gt;“这个招标书的技术部分，你写一下吧。”&lt;/p&gt;
&lt;p&gt;“你得想想我们的技术壁垒是什么，没有也给我编点出来。”&lt;/p&gt;
&lt;p&gt;“什么，都已经24小时了，昨天那个需求你没做好？“&lt;/p&gt;
&lt;p&gt;“老板啊，我那个项目没交付好不是因为我不好啊，是因为产品有bug啊，研发没解决呀“&lt;/p&gt;
&lt;p&gt;”因为研发没支持的，为什么要我来加班？“&lt;/p&gt;
&lt;p&gt;”为什么要重构？一定是技术能力不行吧，一定是开始选型没选好！“&lt;/p&gt;
&lt;p&gt;“性能到瓶颈了，你怎么不一开始就做一百倍呢？”&lt;/p&gt;
&lt;p&gt;⚠️：以上对话全来自现实取材。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;总之，这群，虽然可以说是最需要专注、不该被打扰的人，但往往确实经常是被迫营业最多的一群人。&lt;/strong&gt; 永远有着解释不清楚的状况，和对牛弹琴般（对于不理解技术的、也没有开放思维的人）无法被理解和认同的痛苦。&lt;/p&gt;
&lt;p&gt;似乎唯一能让他们的世界少一些攻击的解决方案，也就只有无尽的加班了。&lt;/p&gt;
&lt;p&gt;我曾问过提供过上述对话的同学，问为什么ta们觉得这些要求合理。&lt;/p&gt;
&lt;p&gt;有时候，逻辑其实很强盗，很显然，在一部分人眼里，可笑的是：就因为研发们拿着看起来高于其他职位的死工资，似乎ta们就理所应当需要对一切负责。&lt;/p&gt;
&lt;p&gt;我对这些想法非常武断地、嗤之以鼻。&lt;/p&gt;
&lt;p&gt;🙏感谢&amp;#x26;报恩&lt;/p&gt;
&lt;p&gt;我对研发们的感情一直只有：感谢和报恩。&lt;/p&gt;
&lt;p&gt;这份感情没有差别，无论对象是何种类型的研发工程师，无论ta是把研发工作当作谋生技能，还是对技术/研发抱有热情。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;因为没有研发工程师，我将无法看到自己的设计真正出现在这个世界上。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;年轻的时候，我认为研发和产品的合作就是手拉着手、携手同行或者是上下游各司其职。但后来我觉得这个想法还是太浅。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;最好的产研之间的合作应该是：背靠背并肩作战。真正的战友是你可以把自己的背后交给ta的那一种。&lt;/strong&gt; 产品经理为研发去解决一切后顾之忧，而研发用高质量的代码来为产品保驾护航。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;至于产品经理对研发最好的报恩，便是尽可能的让产品成功&lt;/strong&gt;，不过，成功通常是因缘和合的结果，不是几个角色可以决定的。但我们依然有一些事情可以做，比&lt;strong&gt;如至少做到以下三点：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;不让他们白干（别把它们的时间浪费在没有价值的事儿上）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;不让他们瞎忙（别让他们一会儿干这个一会儿干那个）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;不让他们干得不清不楚的（别让他们自己去猜暧昧不清、模棱两可的需求到底是什么）&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;🌟写在最后&lt;/p&gt;
&lt;p&gt;一不小心，还是写了2000字 😓，但想写的话其实更多，但就到这里吧，给p爷下次输给我的时候留点余地！（毕竟人也是研发&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;仅以此文，送给p爷，也送给过去、现在、和将来每一位和我曾经合作过、正在合作、将来会合作的研发工程师们，谢谢你们&lt;/strong&gt;。🙏&lt;/p&gt;</content:encoded><category>公众号</category><category>P小二</category></item></channel></rss>