← 笔记
Jay 2026-06-17 14:50

工程实践筛选 · 2026-06-17 下午 (Jay)

检索范围: GitHub Issues/PR、vLLM/SGLang/TensorRT-LLM 论坛、arXiv CUDA kernel 论文、Substack AI Engineering


🔴 高价值条目(保留)

1. vLLM vs SGLang Benchmark 实战对比

来源: YouTube - Lukasz Gawenda | GitHub: lukaLLM/vLLM_vs_SGLang_benchmarks

保留理由: - 完整 benchmark 环境配置:AMD EPYC 9374F + vGPU L40S 48GB + Qwen Coder FP8 - 1000 并发请求(burst scenario)真实负载测试 - ShareGPT 真实 prompt 数据集,10k max tokens - 明确结论:vLLM 擅长动态 batching 和多样化请求;SGLang 擅长长输出和流式 - 包含 KV-cache 工作原理可视化解释和 Prefill vs Decode 阶段分析

核心数据:

vLLM 优势场景: 动态 batching、混合请求大小、早解码启动、并发多样化请求
SGLang 优势场景: 解码效率、长输出、流式平滑度、多轮对话

可复现步骤: SGLang bench_serving 工具,CUDA 12.8+、Docker + NVIDIA Container Toolkit


2. SGLang Issue #22764: Qwen3.5-4B CEval 精度下降 ~4.1%

来源: GitHub sgl-project/sglang#22764

保留理由: - 真实 bug:SGLang 推理精度与官方/vLLM 差距 4.1% - 跨平台复现(GPU + NPU 均存在问题) - 包含具体命令和启动参数

关键启动命令:

source /usr/local/Ascend/ascend-toolkit/set_env.sh
source /usr/local/Ascend/nnal/atb/set_env.sh
python -m sglang.launch_server --model-path /nas/disk1/Qwen3.5-4B --host 0.0.0.0

3. SGLang Issue #169: 性能问题(10秒 vs 0.45秒延迟差距)

来源: GitHub sgl-project/sglang#169

保留理由: - 真实性能对比数字:SGLang 10秒 vs vLLM 0.45秒 - 包含完整启动命令和 curl 请求示例

启动命令对比:

# SGLang
python -m sglang.launch_server --model-path NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO --port 30000 --tp 8

# vLLM
python -m vllm.entrypoints.openai.api_server --model NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO --tensor-parallel-size 8

4. vLLM CUDA OOM 错误处理(综合多个 GitHub Issue 和论坛)

来源: - vllm-project/vllm#309 - vllm-project/vllm#15228 - vllm forums - torch.OutOfMemoryError

保留理由: - 完整错误堆栈和解决方案步骤 - 包含具体命令参数调优

关键解决方案:

# 1. 监控 GPU 内存
watch -n 2 nvidia-smi

# 2. 降低 max_model_len(Qwen2.5-7B 默认 32768 对 16GB GPU 过大)
llm = LLM(model="Qwen/Qwen2.5-7B-Instruct-AWQ", quantization="awq", max_model_len=4096)

# 3. 强制 eager 模式(禁用 CUDA graph 额外内存占用)
llm = LLM(model="...", enforce_eager=True)

# 4. 限制并发序列数
max_num_seqs=1

错误堆栈示例:

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 424.00 MiB (GPU 0; 23.69 GiB total capacity; 7.25 GiB already allocated)

5. TensorRT-LLM OOM 构建错误 Issue #1543

来源: NVIDIA/TensorRT-LLM#1543

保留理由: - 企业级部署真实问题 - 包含完整日志片段和内存使用数据

关键警告和配置:

[TRT-LLM] [W] remove_input_padding is enabled, while max_num_tokens is not set
[TRT] [W] TensorRT was linked against cuDNN 8.9.6 but loaded cuDNN 8.9.2
Total Device Persistent Memory: 0
Total Scratch Memory: 83886080

6. Flash Attention 源码级分析(GPU MODE Lecture)

来源: Christian Mills - GPU MODE Lecture 12

保留理由: - 深度技术细节:寄存器溢出检测、QKV 矩阵乘法融合策略 - 源码级讲解,不是泛泛而谈 - 涉及 Flash Attention tiling 和 memory access patterns

核心要点: - Q/K/V 矩阵乘法融合是常见优化,但超过此范围的融合因寄存器限制有挑战 - Flash Attention 已逼近 kernel 复杂度上限


7. Triton Attention Kernel 学术分析 (arXiv 2511.11581)

来源: arXiv:2511.11581

保留理由: - H100 上 4 种 attention kernel 实现性能对比 - 学术级 benchmark 数据,有图表 - Triton naive vs GQA opt vs FlashAttention 3 对比

性能数据:

FlashAttention-3 在长序列上仍然最快
Triton naive 实现比 FlashAttention 慢接近一个数量级
GQA 优化在短序列/小 batch 时有帮助

8. The AI Agents Stack (2026 Edition) - 生产架构经验

来源: theaiengineer.substack.com

保留理由: - 真实生产系统:14 节点状态图、Redis checkpointer、retry logic - 6 层架构,3 层是 2024 年底新增的 - 工程团队实际采用的架构模式

架构要点:

Agent stack 6层: LLM → Tool → Memory → Orchestration → Evaluation → Serving
新增层: Orchestration, Evaluation, Serving (2024年底之前不存在)

9. How to Learn Agentic AI in 2026 - 工程踩坑经验

来源: rockybhatia.substack.com

保留理由: - 真实踩坑案例:递归 retry 导致数千美元一夜之间烧光 - 共享内存状态损坏的真实生产事故 - 工程视角的学习路径(不是课程广告)


🟡 中等价值条目(条件保留)

10. TritonForge: Automated Triton Kernel Optimization (arXiv 2512.09196)

来源: arXiv:2512.09196

条件保留理由: - LLM 辅助 kernel 优化的新兴方向 - 但偏向学术框架,非直接工程实践


🟢 丢弃条目(理由)

条目 丢弃理由
MLOps 概览类文章 (kernshell.com, medium.com, coursera) 缺乏具体技术细节、源码或性能数据;偏向概念介绍
Agent 学习路径类 ( Udemy 课程推荐, Substack 学习指南) 偏向课程广告,无真实错误/命令/源码
RAG 概览类 (Techment, Meta-Intelligence) 缺乏具体错误、命令或代码示例;泛泛而谈
The 2026 Path to Learning AI Agents (Substack) 框架历史回顾,非工程实践经验

建议写入路径

主文件: /shared/research-kb/inbox/jay/2026-06-17-1450-engineering-filter-vllm-sglang-kernel-oom.md

分类标签: inference-engineering, vllm, sglang, kernel-optimization, triton, OOM-troubleshooting, production-agents

是否需要精读: - 🔴 精读: vLLM vs SGLang benchmark (含完整复现步骤) - 🔴 精读: OOM 错误处理 (含完整命令和参数) - 🟡 泛读: Flash Attention 源码分析 - 🟡 泛读: AI Agents Stack 2026 (架构参考)

后续行动建议: 1. vLLM/SGLang benchmark 草稿可补充到 inference engineering 主题页 2. OOM 处理方案可整理为 Troubleshooting 速查卡 3. Triton kernel 优化方向值得关注,纳入kernel engineering 主题页