Tech Blog

Renyuan's Engineering Field Notes

A card-based map of coding agents, LLM routing, serving systems, CUDA/Triton kernels, and transformer foundations. Every date in Renyuan_Log.md is represented below.

53 log days 20 deep dives 20 concepts 5 series

Curated Posts

Deep Dives

Longer articles distilled from multiple related log dates.

Supplement

Concept Map

Short explanations added to fill gaps where the raw log only had keywords, links, or partial notes.

Agent Engineering

FastAPI 中间层

把前端直调接口改造成稳定后端边界,负责参数校验、任务创建、状态查询和产物返回。

Agent Engineering

node-pty 与无头 Agent

node-pty 适合驱动交互式 CLI,但 Web 服务更需要无头化、结构化输入输出和超时控制。

Agent UX

SSE / JSONL

SSE 负责浏览器端单向流式订阅,JSONL 负责生成器向后端持续输出结构化事件。

Coding Agent

RunStore / EventStore

Run 记录任务状态,Event 记录过程事实,Artifact 记录生成产物,是 Agent 可观察性的基础。

Coding Agent

Patch Loop

生成失败后只把错误摘要和少量相关文件交给模型,要求小范围补丁,再次验证。

Deployment

OSS / FC / Docker

OSS 保存产物和静态资源,FC 容器提供运行预览,Docker 统一本地和云端运行环境。

LLM Routing

LLM Router 三问

任何路由策略都应先回答:什么时候决策、看什么信号、用什么算法计算。

LLM Routing

Semantic Override

默认使用强模型,只在语义上足够确定时降级到小模型,比多路直接分类更稳。

LLM Routing

Router Latency

端到端延迟和 router decision latency 不是同一个指标,离线评测不能替代线上延迟验证。

LLM Routing

vLLM Semantic Router

它是信号、投影、决策、模型选择和插件组成的流量控制平面,不只是分类器。

Transformer

RoPE

把隐藏维度两两成对放进二维平面旋转,用方向关系编码位置并保持向量长度。

Training

Activation Checkpointing

训练中用重算换显存,不是保存参数矩阵,而是保存必要边界并在反向时重算激活。

Training

BF16

BF16 保留 FP32 的指数范围但减少尾数精度,适合大模型训练和推理中的动态范围需求。

Serving

KV Cache / PagedAttention

KV cache 保存历史 token 的 K/V,PagedAttention 用块式管理降低连续显存分配压力。

Serving

Tensor Parallel

TP 拆单层计算,ColumnParallelLinear 和 RowParallelLinear 分别对应不同维度切分和通信模式。

Training

FSDP / ZeRO-3

FSDP 和 ZeRO-3 主要分片参数、梯度和优化器状态,目标是训练省显存。

Deployment

Ascend NPU 调度

NPU 任务失败可能来自镜像、模型兼容、队列配额、CPU/内存请求、HCCL 或共享存储。

CUDA

CUDA Reduction

高效规约通常按 thread-local、warp、block、global 层级推进,尽量减少 global memory 访问。

Triton

Operator Fusion

融合算子的收益来自减少中间结果写回 global memory,而不是把多个函数简单放在一起。

Triton

LayerNorm vs RMSNorm

RMSNorm 只去长度,LayerNorm 同时去均值和长度;这个统计量差异会变成 kernel 成本差异。

Complete Coverage

Full Log Map

Each card corresponds to one dated section in Renyuan_Log.md. Timeline-only cards preserve context without forcing weak notes into articles.

2025-03-19 · Agent Engineering · covered

FastAPI、TypeScript 与第一次工程化拆分

从 TypeScript/npm 基础和 FastAPI 框架入门开始,把原先前端直调 API 的教育项目拆出后端层,建立前后端分离的第一版验证路径。

FastAPI REST API TypeScript npm

Open original section

2025-03-20 · Agent Engineering · covered

OnlySpecs 调研与 WSL 网络修复

调研 OnlySpecs 作为 Workshop 低代码生成的候选开源 Agent,同时处理 WSL/Linux 网络和 Claude API 调用环境问题。

OnlySpecs WSL Claude CLI 环境配置

Open original section

2025-03-21 · Agent Engineering · covered

Electron Agent 如何改造成 Web 服务

梳理 OnlySpecs 的 Electron、IPC、node-pty 和 Node.js Web Server 结构,比较原 Workshop 架构和开源 Agent 架构的对接方式。

Electron node-pty IPC SSE

Open original section

2025-03-22 · Agent Engineering · deep-dive

OnlySpecs Web 化与输出物抽象

完成 FastAPI 代理、SSE、ZIP 打包和 Web 菜单汉化,并开始把源代码、Web 应用、桌面程序、PWA 作为不同输出物设计。

ZIP 打包 SSE Build Worker 低代码平台

Open original section

2025-03-23 · Agent Engineering · covered

Docker、FastAPI 与 FC 容器初步架构

学习 Docker/FastAPI 后,把 Workshop 运行链路拆成 FastAPI 前端、API Server、生成器、FC 容器和 OSS 存储。

Docker FC 容器 OSS FastAPI

Open original section

2025-03-24 · Agent Engineering · deep-dive

云端运行闭环与端口、代理、镜像问题

围绕生成项目的本地验证、镜像构建、OSS 上传、FC 启动和端口冲突做系统排障,形成云端运行闭环雏形。

Docker 镜像 端口冲突 HTTP probe 部署验证

Open original section

2025-03-25 · Agent Engineering · covered

Coding Agent 工作流与沙箱安全

从多 Agent 使用体验推进到 Coding Agent 方案二,提出生成、验证、修复、再验证的闭环,并补充沙箱、工具层和运行安全思考。

Coding Agent 沙箱 RunStore 自动修复

Open original section

2026-03-26 · Agent Engineering · deep-dive

复杂 Agent 流程落地与 Docker 打包

把 /generate/agent 流程具体化为 RunStore、workspace、events、validation、patch loop,随后简化成 /runs 并完成 Docker 打包验证。

RunStore Patch Loop Docker Workflow

Open original section

2026-03-27 · Agent Engineering · covered

从 Agent 能力优先到格式化输出

反思先做强 Agent 再对接 OSS/FC 的工程顺序,设计 IntentDetector 和 ProjectPromptEnhancer,把简单需求变成结构化项目生成任务。

IntentDetector Prompt Enhancer TypeScript 项目生成

Open original section

2026-03-28 · Agent Engineering · deep-dive

opencode 改造与流式 Agent UX

改造 opencode 工作流,封装 FastAPI 调用,并设计 SSE/JSONL 事件,让前端展示文件树、代码预览和安全阶段状态。

opencode JSONL SSE Agent UX

Open original section

2026-03-29 · Timeline · timeline

毕业设计优先日

当天主要转向毕业设计事项,技术博客中作为学习节奏节点保留,不单独扩展成技术文章。

Milestone 学习节奏

Open original section

2026-03-30 · Agent Engineering · covered

Workshop 在线运行与架构路线收敛

重新讨论 Workshop 的目的,从在线 Coding Agent、Skill pipeline 和 World Model 学习中收敛到可运行、可调试、可展示的 MVP 路线。

Workshop Skill World Model MVP

Open original section

2026-04-01 · Agent Engineering · covered

Workshop MVP 重构启动

基于 Agent-Do 启动 Workshop 架构重构,目标是用更小、更稳的 MVP 替代复杂旁路集成。

Agent-Do MVP 架构重构

Open original section

2026-04-02 · Agent Engineering · covered

Docker 与项目未来定位

继续补 Docker 基础,同时讨论项目定位:每天早晨五分钟了解 AI 圈大事并上手实践,Workshop 需要服务这个主目标。

Docker 产品定位 Agent-Do

Open original section

2026-04-03 · Agent Engineering · deep-dive

容器 Workspace 与 Docker CLI 排障

定位 Agent-Do 子容器 workspace 挂载路径错误和 Docker CLI input/output error,形成 MVP 运行环境的关键排障经验。

Workspace Docker CLI 路径挂载 容器调试

Open original section

2026-04-04 · Transformer Foundations · covered

PageAttention 与 Flash Attention 入口

记录 PageAttention 和 Flash Attention 的学习入口,后续并入 vLLM、KV cache 和 attention backend 的系统理解。

PagedAttention FlashAttention KV Cache

Open original section

2026-04-05 · Timeline · timeline

毕业设计推进

当天主要投入毕业设计,作为时间线节点保留。

Milestone

Open original section

2026-04-06 · Timeline · timeline

非技术休整

记录个人休整内容,不转成正式技术文章。

Timeline

Open original section

2026-04-07 · LLM Routing · deep-dive

LLM Router 设计空间

从决策时机、使用信号和计算方式拆解 LLM Router,并整理 difficulty-aware、preference、clustering、RL、uncertainty、cascade 等路线。

LLM Router Cascade Uncertainty Routing Survey

Open original section

2026-04-08 · LLM Routing · covered

Router Pipeline 与经典论文复现顺序

搭建自己的 Router pipeline,并梳理 AutoMix、FrugalGPT、BEST-Route、GraphRouter、CP-Router 等代表方法的复现优先级。

Pipeline AutoMix FrugalGPT RouteLLM

Open original section

2026-04-09 · LLM Routing · deep-dive

RouteLLM GSM8K 复现

比较 strong、weak、random 和 router 策略在 GSM8K 上的准确率与成本,形成 cost-performance tradeoff 的第一轮数据。

RouteLLM GSM8K Cost Accuracy

Open original section

2026-04-10 · LLM Routing · deep-dive

Semantic Router 接入与延迟口径

把 semantic-router 作为检索式分类器接入评测链路,确认 accuracy/cost 可比,但 router decision latency 仍需独立定义。

semantic-router Latency Evaluation Embedding

Open original section

2026-04-11 · LLM Routing · deep-dive

Semantic Override 实验

从五路 tiered 路由转向 strong default + smaller override,发现 MPNet、metadata 和 threshold tuning 才是关键收益来源。

MPNet Override Threshold Metadata

Open original section

2026-04-12 · Transformer Foundations · covered

CS336、MoE 与训练系统概念

整理 CS336 作业、einsum、模型参数估算、MoE、PPO/GRPO/DPO 等基础入口,为后续训练系统文章补概念底座。

CS336 einsum MoE GRPO

Open original section

2026-04-13 · Transformer Foundations · deep-dive

Checkpoint、BF16 与 Linear 权重布局

把 activation checkpointing、FP32/FP16/BF16、einsum 和 Linear 权重矩阵布局串起来,形成训练基础文章。

Activation Checkpointing BF16 Linear einsum

Open original section

2026-04-14 · LLM Routing · deep-dive

vLLM Semantic Router 架构

拆解 Signals、Projections、Decisions、Algorithms、Plugins 与 Envoy extproc 路径,定位它是 LLM 流量控制平面。

vLLM Semantic Router Envoy Control Plane Plugins

Open original section

2026-04-15 · Timeline · timeline

空白日期占位

原始日志没有展开内容,在完整覆盖中保留日期占位,避免时间线断裂。

Timeline

Open original section

2026-04-16 · Timeline · timeline

空白日期占位

原始日志没有展开内容,在完整覆盖中保留日期占位。

Timeline

Open original section

2026-04-17 · Transformer Foundations · deep-dive

RoPE 几何与代码实现

把 RoPE 理解成 D/2 个二维平面旋转,并用 rearrange、unbind、stack 解释 PyTorch 实现。

RoPE Position Encoding PyTorch Rotation

Open original section

2026-04-20 · Transformer Foundations · deep-dive

Encoder 输出 Z 到 K/V

解释 Encoder 最终输出作为 memory,被 Decoder cross-attention 投影成 Key 和 Value。

Encoder Memory K/V Attention

Open original section

2026-04-22 · LLM Routing · covered

vLLM Router 实跑与 MoM 配置

实际跑通 vLLM Router,确认 model=MoM 才会进入路由,单 modelRef 配置本质上仍是规则分类到固定模型。

MoM Decision Route modelRef

Open original section

2026-04-26 · CUDA / Triton / Kernel Notes · covered

CUDA 执行模型与 LLM 优化入口

从 thread、block、warp、memory hierarchy 建立 CUDA 心智模型,连接到 LLM kernel 优化的算力与带宽判断。

CUDA Thread Warp Memory Hierarchy

Open original section

2026-04-27 · Timeline · timeline

Faraway 项目进展

记录 faraway 后端和安卓 APP 打包成功,技术细节不足,作为项目 milestone 收录。

Android Backend Milestone

Open original section

2026-04-28 · CUDA / Triton / Kernel Notes · covered

CUDA 内存分配与拷贝

学习 cudaMemcpy 目标地址语义、cudaMemcpyDefault、cudaMallocManaged 与 CPU/GPU 内存一致性。

cudaMemcpy cudaMallocManaged Unified Memory

Open original section

2026-04-29 · Transformer Foundations · covered

RoPE 频率、NTK-aware 与 YaRN

进一步区分位置 n 和频率 theta_i,理解高频近距、低频长距,并连接长上下文 RoPE 扩展。

RoPE NTK-aware YaRN Long Context

Open original section

2026-04-30 · Serving & Deployment · covered

推理框架选型入口

在 vLLM、vLLM-Ascend、SGLang-Ascend、xLLM 中建立选型入口,后续聚焦 vLLM 工程边界。

vLLM SGLang xLLM Serving

Open original section

2026-05-01 · Serving & Deployment · covered

GPU 集合通信基础

整理 Gather、Reduce、AllReduce、Broadcast、Scatter 等 GPU 通信操作,为 TP/FSDP/ZeRO-3 对比做铺垫。

AllReduce Gather Reduce Broadcast

Open original section

2026-05-04 · Serving & Deployment · deep-dive

vLLM 工程边界与请求生命周期

从目录地图、LLMEngine、Scheduler、KVCacheManager、ModelRunner 理解一次请求如何被 vLLM 推进。

vLLM Scheduler KV Cache PagedAttention

Open original section

2026-05-05 · Serving & Deployment · covered

张量并行与 Linear 切分

学习 ColumnParallelLinear、RowParallelLinear、Megatron/vLLM 中线性层切分与通信关系。

Tensor Parallel ColumnParallelLinear RowParallelLinear

Open original section

2026-05-07 · Timeline · timeline

短记录占位

原始日志仅保留日期,没有技术展开;完整时间线保留该节点。

Timeline

Open original section

2026-05-08 · Timeline · timeline

短记录占位

原始日志仅保留日期,没有技术展开;完整时间线保留该节点。

Timeline

Open original section

2026-05-09 · Timeline · timeline

短记录占位

原始日志仅保留日期,没有技术展开;完整时间线保留该节点。

Timeline

Open original section

2026-05-10 · Timeline · timeline

短记录占位

原始日志仅保留日期,没有技术展开;完整时间线保留该节点。

Timeline

Open original section

2026-05-11 · Serving & Deployment · deep-dive

FSDP/ZeRO-3、TP 与权重分片

比较 FSDP/ZeRO-3 与张量并行的目的差异,并通过 narrow、offset、slided_weight 理解权重切片。

FSDP ZeRO-3 Tensor Parallel narrow

Open original section

2026-05-12 · Serving & Deployment · covered

mini-vLLM 源码阶段完成

mini-vLLM 源码学习阶段收束,作为理解 vLLM 请求生命周期和 runtime 边界的 milestone。

mini-vLLM Runtime Milestone

Open original section

2026-05-13 · Serving & Deployment · covered

DeepSeek V4 Flash 资源评估

盘点 DeepSeek V4 Flash、Pro、W8A8、BF16、NPU 资源和 YaRN RoPE 扩展,为 vLLM-Ascend 部署做准备。

DeepSeek V4 W8A8 NPU YaRN

Open original section

2026-05-14 · Serving & Deployment · covered

DeepSeek V4 环境手动配置

持续手动配置 DeepSeek V4 环境,并完成 LeetGPU Easy 阶段,积累推理服务和 GPU/NPU 实操经验。

DeepSeek V4 环境配置 LeetGPU

Open original section

2026-05-15 · Serving & Deployment · covered

DeepSeek V4 启动阻塞定位

梳理部署需求和现有配置,记录镜像、架构、NPU 数量、vLLM-Ascend bug 等阻塞,并在次日修正部分判断。

vLLM-Ascend 镜像兼容 NPU 调度 OOM

Open original section

2026-05-16 · Serving & Deployment · deep-dive

DeepSeek V4 Flash 单节点跑通与 NPU 调度

确认单节点 16 NPU 可跑通 DeepSeek V4 Flash W8A8,并整理镜像、patch、MTP、KV cache bug、Volcano/ktp 调度经验。

DeepSeek V4 Flash vLLM-Ascend Volcano HCCL

Open original section

2026-05-17 · CUDA / Triton / Kernel Notes · deep-dive

CUDA kernel、device function 与 reduction

区分 __global__ kernel 和 __device__ function,学习 warp-level/block-level reduction、Grid-Stride Loop 和 shared memory。

CUDA Kernel Reduction Grid-Stride Loop Shared Memory

Open original section

2026-05-20 · CUDA / Triton / Kernel Notes · covered

融合算子与 fused softmax

从课程记录中抽象 fused softmax、relu/silu/sigmoid 融合和一次加载多次计算的内存带宽直觉。

Fused Softmax Operator Fusion Memory Bandwidth

Open original section

2026-05-21 · CUDA / Triton / Kernel Notes · deep-dive

数值处理、softmax 融合与 block 规约

整理 log-softmax、softmax dropout、softmax + element-wise、block 划分和规约,为 Triton 实现做准备。

Triton Softmax Block Reduction Dropout

Open original section

2026-05-22 · CUDA / Triton / Kernel Notes · deep-dive

LayerNorm 与 RMSNorm 几何理解

用超球面和过球心超平面解释 RMSNorm 与 LayerNorm 的自由度差异,并连接 Triton kernel 累加器成本。

LayerNorm RMSNorm Geometry Triton

Open original section