🧠 [AI] 浅谈 Transformer 的推理流程

在这几年 LLM 的飞速发展中,为了均衡智能效果、推理成本和推理速度,transformer 架构已经改得妈都不认识了。
因为我的本职工作并不是做 AI Infra 的,学习 LLM 主要还是用来满足好奇心,想知道 Agent 背后的模型中,token 都是如何流转加工的,所以我参考了各种书籍和经典的 GPT-2,梳理了 LLM 的推理流程,专程记录下来,祭奠一下刚逝去不久的手搓代码时代。

在这几年 LLM 的飞速发展中,为了均衡智能效果、推理成本和推理速度,transformer 架构已经改得妈都不认识了。
因为我的本职工作并不是做 AI Infra 的,学习 LLM 主要还是用来满足好奇心,想知道 Agent 背后的模型中,token 都是如何流转加工的,所以我参考了各种书籍和经典的 GPT-2,梳理了 LLM 的推理流程,专程记录下来,祭奠一下刚逝去不久的手搓代码时代。

Just some random thoughts today - not as serious as my usual posts.
A friend recently shared a blog post called The Next Two Years of Software Engineering, and it was genuinely good. When I checked the author, I realized it was Addy Osmani - someone I've been following for years (well, in the "I follow him, he doesn't know I exist" kind of way).

If we consider all human operations on a computer as the universal set, then the operational scope of Computer, Browser, CDP, and puppeteer can be categorized as follows:
In Browser-Use scenarios, unlike VNC which is a more general screen casting solution, CDP has capability boundaries. Therefore, understanding its strengths and limitations is significant for overall architectural design and future evolution direction.

Chrome DevTools Protocol (CDP) is the core communication protocol for Chromium browser debugging tools: it's based on JSON format and enables bidirectional real-time interaction between clients and the browser kernel through WebSocket.

On September 23, 2025, Google released Chrome DevTools MCP, currently at version 0.9.0. Google positions it as an assistant for AI coding agents to handle debugging and performance testing, improving web development debug capabilities. See the official blog for use cases: Chrome DevTools (MCP) for your AI agent.
This post analyzes Chrome DevTools MCP's implementation by examining the source code and MCP output, exploring its capabilities and limitations.

Recently I've been working on Browser Agent related tasks, so I've been referencing various open-source browser automation libraries. The most famous among these is Puppeteer.
Puppeteer's code style has a very strong Google open-source style - concise and accurate code, with documentation that's basically useless. Its documentation is actually auto-generated from source code comments, basically only showing API specifications, requiring you to use deepwiki and source code to locate specific usage patterns and ideas.
While reading through Puppeteer's source code, I discovered they wrote a very clever "mutex" solution that uses some new JavaScript APIs. I learned quite a bit during the deconstruction process. Below, starting from a practical scenario, I'll show how to write an elegant mutex from 0 to 1 using TypeScript.

Hello everyone, it's been over a year since my blog was last updated. I guess the SEO ranking has dropped completely, and I don't know how many people will see this in the end.
Starting from May last year, due to organizational structure changes at work, I shifted from the performance optimization field to AI. Due to confidentiality agreements, I can't say much about the specific content, so I haven't updated for a long time. This year, my work direction has changed again, mainly focusing on GUI Agent work.
A year has passed, but the programming field has undergone earth-shaking changes. With the launch of tools like Cursor/Claude Code, everyone has basically broken free from the constraints of traditional programming methods (let's not worry about whether the generated code is correct, just ask if it's fast or not); many departments are not satisfied with the efficiency gains from external programming tools and have started building their own internal Agents, attempting to double efficiency in both business and engineering. Since my recent work involves more collaboration with large model teams, I feel this more deeply, and I'll have opportunities to share my insights slowly in the future.

In 2025, discussing RAG (Retrieval-Augmented Generation) technology might not seem particularly fashionable in the rapidly evolving AI landscape. However, from a practical implementation perspective, RAG offers low technical barriers and significant performance improvements. With clear expected benefits, many institutions, companies, and departments are implementing RAG solutions, while researchers continue proposing various optimization approaches to enhance accuracy.
"The sculpture is already complete within the marble block, before I start my work. It is already there, I just have to chisel away the superfluous material." ― Michelangelo

Hello everyone, I am skychx, specializing in performance optimization.
When doing web-related performance optimization, it is necessary to have a certain understanding of the underlying principles of the browser, so that the page can better walk on the happy path. Today, let's understand a browser default performance optimization scheme that is rarely known by people - HTML Preload Scanner, and see how it optimizes the loading speed of network resources.