Paddle Build
PaddlePaddle/Paddle
A skill your agent uses when needing to compile, rebuild, or install Paddle from source after code changes.
给 FlashRec 引擎接入一个新模型架构(新的 HF checkpoint / 非 Qwen3 结构)。涵盖模型定义、权重合并加载、FP8 双路径、融合 kernel 接线、CUDA graph 兼容、精度校验、以及压测+trace 验证闭环。当用户要"增加/支持/接入新模型"时使用。
$ npx skills add sohu-mptc/FlashRec --skill add-model -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install sohu-mptc/FlashRec add-model --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/sohu-mptc/FlashRec.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/add-model .claude/skills/add-model && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "add-model" agent skill from https://github.com/sohu-mptc/FlashRec/tree/main/.claude/skills/add-model into .claude/skills/add-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "add-model", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/sohu-mptc/FlashRec/tree/main/.claude/skills/add-modelType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add sohu-mptc/FlashRec --skill add-model -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install sohu-mptc/FlashRec add-model --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sohu-mptc/FlashRec.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/add-model .agents/skills/add-model && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "add-model" agent skill from https://github.com/sohu-mptc/FlashRec/tree/main/.claude/skills/add-model into .agents/skills/add-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "add-model", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add sohu-mptc/FlashRec --skill add-model -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install sohu-mptc/FlashRec add-model --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sohu-mptc/FlashRec.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/add-model .cursor/skills/add-model && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "add-model" agent skill from https://github.com/sohu-mptc/FlashRec/tree/main/.claude/skills/add-model into .cursor/skills/add-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "add-model", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/sohu-mptc/FlashRec.git --path .claude/skills/add-model--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add sohu-mptc/FlashRec --skill add-model -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install sohu-mptc/FlashRec add-model --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sohu-mptc/FlashRec.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/add-model .gemini/skills/add-model && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "add-model" agent skill from https://github.com/sohu-mptc/FlashRec/tree/main/.claude/skills/add-model into .gemini/skills/add-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "add-model", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install sohu-mptc/FlashRec add-modelInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add sohu-mptc/FlashRec --skill add-model -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/sohu-mptc/FlashRec.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/add-model .github/skills/add-model && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "add-model" agent skill from https://github.com/sohu-mptc/FlashRec/tree/main/.claude/skills/add-model into .github/skills/add-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "add-model", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add sohu-mptc/FlashRec --skill add-model -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install sohu-mptc/FlashRec add-model --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sohu-mptc/FlashRec.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/add-model .opencode/skills/add-model && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "add-model" agent skill from https://github.com/sohu-mptc/FlashRec/tree/main/.claude/skills/add-model into .opencode/skills/add-model/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "add-model", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
add-model给 FlashRec 引擎接入一个新模型架构(新的 HF checkpoint / 非 Qwen3 结构)。涵盖模型定义、权重合并加载、FP8 双路径、融合 kernel 接线、CUDA graph 兼容、精度校验、以及压测+trace 验证闭环。当用户要"增加/支持/接入新模型"时使用。
Add Model is an agent skill from sohu-mptc/FlashRec. 给 FlashRec 引擎接入一个新模型架构(新的 HF checkpoint / 非 Qwen3 结构)。涵盖模型定义、权重合并加载、FP8 双路径、融合 kernel 接线、CUDA graph 兼容、精度校验、以及压测+trace 验证闭环。当用户要"增加/支持/接入新模型"时使用。
Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in AI & LLM Engineering. It works with Qwen, CUDA and Python. The repository describes itself as: FlashRec is a CUDA-graph engine for generative recommendation: wide beam search (3–5 SID steps, n=50–512+) over a trie-constrained catalog, in-process FP8 serving, and ranked… The licence is Apache-2.0.
7 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 1089682. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
pythoncurlFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
ui.perfetto.devFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Add Model loads about 1.7k tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 548 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from sohu-mptc/FlashRec at commit 1089682, republished under its Apache-2.0 licence (© sohu-mptc). 548 words, ~1,676 tokens.
.claude/skills/add-model/SKILL.md (or your agent's skills folder).FlashRec 当前 TP=1,唯一模型是 Qwen3(python/flashrec/models/qwen3.py)。接入新模型不是"写个 nn.Module"就完了——现有优化大多在模型层有接线点,漏掉任何一个都会直接掉性能或破坏 CUDA graph。按下面顺序做。
python/flashrec/models/qwen3.py — 参考实现,所有优化点的接线范例python/flashrec/models/weight.py — 权重合并加载范例python/flashrec/engine/engine.py — 装配点(config 解析、KV pool 预算、AttentionBackend、模型实例化)python/flashrec/sid_layout.py — tokenizer 约定与 SID 布局推断docs/architecture.md — 请求路径与模块地图<name>.py)复制 qwen3.py 作为骨架,逐项对照新模型的 HF config.json 改。必须保留的优化结构(每一项都有实测收益,不是风格偏好):
qkv_proj = Linear(hidden, (n_q + 2*n_kv) * head_dim),forward 里用 view 切成 per-head 视图(零拷贝),rope/store kernel 接受显式 stride。同理 MLP 用 gate_up_proj 融合。q_fp8 / a_scale(上一层 RMSNorm 融合量化的输出),有则走 Linear.forward_fp8,无则走普通路径。DecoderLayer 里 _use_fused_quant() 门控,input_layernorm.quant_fp8(x, residual) 产出下一个 GEMM 的 FP8 激活。enable_fused_rms_fp8 / enable_fused_silu_fp8 / enable_fused_qk_rope_kv):fused_qk_norm_rope_store_fp8(kernel/qk_rope_kv.py):QK-RMSNorm + RoPE + FP8 KV 写入单 kernel,仅当 pool.dtype == float8_e4m3fn 且 out_cache_loc 非空时走;返回 False 时必须有完整 fallback(q_norm/k_norm → apply_rope_and_store_kv → 再 fallback 到 self.rotary)。新模型若没有 qk-norm,需要改这个 kernel 或跳过 norm 部分,不要静默传单位权重以外的东西。silu_and_mul_per_token_quant_fp8(kernel/silu_fp8.py):激活函数不是 SwiGLU 的模型(如 GELU)不能直接用,需新写融合 kernel 或退化为 eager + per_token_quant_fp8。RMSNorm.quant_fp8(layers/norm.py):LayerNorm 模型(非 RMSNorm)同理需要新路径。self.attn.forward(q.contiguous(), k, v, layer_id, batch, skip_store=stored) — 融合 kernel 已写过 KV 时必须传 skip_store=True,否则双写。q 在融合 rope 后是 qkv buffer 的 strided view,FlashInfer 要 contiguous,这一次小 copy 是刻意保留的(k/v 不需要)。(hidden, residual) 二元组,RMSNorm 的 fused add-residual 签名 norm(x, residual)。不要改成单张量往返(会多一次 add kernel,且破坏 quant_fp8 融合)。embed_tokens.weight。RestrictedLMHead(logits.py)会对它做 index_select 出 special-token 子集——GenRec 场景 LM-head GEMM 从 vocab 全量缩到 ~1.5k 行,不要绕过。GQA 参数:num_kv < num_qo 时 KV pool、AttentionBackend、qkv 融合的维度全部由 config 的 num_key_value_heads/head_dim 驱动,不要 hardcode。MoE / MLA / 滑窗注意力等结构性差异超出现有 AttentionBackend 能力,先在 attention/flashinfer.py 层面评估,再动模型层。
在 load_hf_config 里加新架构分支(按 config.json 的 architectures 字段分发;当前它无条件按 Qwen3 解析,第一个新模型进来时要重构成注册表)。load_weights 的关键约定:
merge_qkv_weights / merge_gate_up_weights 沿输出维 cat,weight_scale 同步 cat,不 requantize(FP8 checkpoint 的 per-channel scale 直接拼)。新模型的投影名不同(如 wqkv、w1/w3)就加对应的 pending bucket。.weight_scale / .weight_scale_inv 先扫一遍建 scale_map,权重 dtype 为 float8_e4m3fn 时带 scale 调 Linear.load(w, weight_scale=...);BF16 checkpoint + --quantization fp8 时 Linear.load(w, quantize_fp8=True) 在线量化(per-channel absmax)。config.json 有无 quantization_config;没有的话必须显式 --quantization fp8 才会启用 FP8 GEMM。engine.py 目前无条件 load_hf_config(ModelEngine.__init__ 内)后实例化 Qwen3ForCausalLM,两处都要改成按架构分发。KV pool 的 token 预算用 bytes_per = 2 * n_kv * head_dim * n_layers * dtype_size,新模型只要 config 字段对就自动正确。sid_layout.py 从 tokenizer 的 <s_a_0> codebook 与 <|sid_begin|> / <|sid_end|>,再结合 --sid-vocab-file 推断,不再写死在 config.py。新词表沿用这套 added-token 命名即可;否则扩展 sid_layout.py,或让用户传 --sid。RestrictedLMHead 仍按推断出的 token 区间做 index_select。DecodeGraphRunner(engine/graph.py)捕获 model forward + restricted LM-head + fused expand 整段。新模型 forward 里不能有 capture-unsafe 操作:不能有 .item() / .tolist() / host 分支依赖张量值 / 动态 shape 分配。凡是 if tensor 条件 的门控(如 fused kernel 的 fallback 判断)必须在 capture 前静态确定。捕获失败通常表现为 warmup 阶段 crash 或静默 fallback 到 eager(QPS 直接腰斩,去 trace 里看有没有 replay)。tests/test_mlp.py(kernel vs PyTorch 参考实现,torch.testing.assert_close)给新模块写等价性测试;tests/test_parity.py 有算法层 parity 模式。跑 PYTHONPATH=python python -m unittest discover -s tests。SGLANG_BEAM_URL=http://... PYTHONPATH=python python -m unittest tests.test_parity(temperature=0 比 choices 与 scores)。id(req)(地址回收串状态),不是数值噪声。注意 instrumentation 本身的 sync 会破坏 CUDA graph capture 掩盖现象。每一轮改动都走同一个闭环,不优于基线就回退("感觉会更快"不算数):重启 server(当前工作树代码)→ 固定负载压测 → 采 trace → 等 trace 落盘完成。每轮固定 model-path / --sid-vocab-file / beam 宽度 / 并发,换了任何一项旧基线就不可复现。生产路径是 --model-path + --sid-vocab-file,不要把旧 checkpoint 的 token id 写进脚本。
压测用 scripts/eval_beam_matrix.py(单格)或 scripts/run_sglang_flashrec_matrix.sh(beam × 并发矩阵),起服务见 scripts/serve.sh 与 model-deploy skill。
采 trace(server 端口按 PORT,serve.sh 默认 8000):
export FLASHREC_TORCH_PROFILER_DIR=./profiles # 落盘目录,或在请求体传 output_dir
curl -sf -X POST http://127.0.0.1:8000/start_profile \
-H 'Content-Type: application/json' \
-d '{"num_steps":200,"profile_prefix":"mymodel","output_dir":"./profiles/mymodel_r1"}'
# ... 打压测流量 ...
curl -sf -X POST http://127.0.0.1:8000/stop_profile接口细节与区间名见 profile-serving skill。
trace 落盘要 10–30s,期间压测数据会被污染(p99 明显抬高)——必须等文件大小稳定,落盘完成前的压测数字全部作废。
trace 用 https://ui.perfetto.dev/ 打开,按怀疑方向看:整体 GPU 空泡率先定位哪段疼;gap 归因到具体 python frame;forward 是 GPU-bound 还是 launch-bound(新模型最常见问题:eager 逐层 launch);decode 步间节奏 / duty cycle;cudaMalloc/Free/Sync stall 与 graph replay 是否生效;以及某个埋点 span 的内部分解。
新代码里加埋点用 from flashrec.profiler import trace_range,with trace_range("flashrec.<区域名>"): 包住 scheduler/模型的 host 区域,会同时进 chrome trace 和 NVTX。
测量三坑(违反任何一条得出的结论直接作废):
PYTHONPATH=python python -m unittest discover -s tests 全绿replay(不是 eager),forward 为 GPU-bound© sohu-mptc, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .claude/skills/add-model of sohu-mptc/FlashRec.
Open the folder on GitHubat commit 1089682
Add Model next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Add Model this skillsohu-mptc/FlashRec | 107 | — | ~1.7k | Automated safety check: Pass | Apache-2.0 | |
| Paddle BuildPaddlePaddle/Paddle | 24k | — | ~1k | Automated safety check: Pass | Apache-2.0 | |
| Paddle Design CompilerPaddlePaddle/Paddle | 24k | — | ~3.6k | Automated safety check: Pass | Apache-2.0 | |
| Qwen Mtp GgufR6410418/Jackrong-llm-finetuning-guide | 1.7k | — | ~1.7k | Automated safety check: Pass | MIT | |
| Pocketmen With Yousix-nut/PocketMen-with-you | 310 | — | ~2.6k | Automated safety check: Pass | MIT | |
| Paddle DebugPaddlePaddle/Paddle | 24k | — | ~1.4k | Automated safety check: Pass | Apache-2.0 |
PaddlePaddle/Paddle
A skill your agent uses when needing to compile, rebuild, or install Paddle from source after code changes.
PaddlePaddle/Paddle
A skill your agent uses when working with Paddle 3.0 compiler full pipeline: SOT (Symbolic Opcode Translator) for bytecode-level dy2st graph capture, PIR (Paddle IR) for SSA-based intermediate…
R6410418/Jackrong-llm-finetuning-guide
Complete agent-ready workflow for Qwen-family MTP or nextn GGUF conversion and release.
six-nut/PocketMen-with-you
Turn 2+ user reference images into a high-fidelity animated Codex companion using PocketMen's own local stack.
PaddlePaddle/Paddle
在 Paddle 代码库中定位问题并输出高质量调试报告的专用技能。当遇到以下场景时优先使用:(1) Paddle 框架 bug 调试,(2) 算子实现问题排查,(3) 训练脚本异常诊断,(4) 分布式训练故障定位,(5) CUDA/GPU 相关错误处理,(6) 需要生成结构化调试报告。
CVCUDA/CV-CUDA
Drive a single-operator optimization campaign per .agents/guidance/OPTIMIZATIONGUIDELINES.md, with a deterministically enforced definition-of-done and versioned MR summary.
sohu-mptc/FlashRec
Deploy and serve GenRec checkpoints with FlashRec (install, serve.sh, SID trie, wide-beam knobs, health/curl, FP8, profiling).
sohu-mptc/FlashRec
Run RecIF beam×concurrency eval and FlashRec vs SGLang/vLLM/TRT-LLM baselines.
sohu-mptc/FlashRec
Build SID trie catalogs for FlashRec from OpenOneRec RecIF packed mappings.
sohu-mptc/FlashRec
Capture torch.profiler traces on a running FlashRec server. An agent skill from sohu-mptc/FlashRec.
Categories
给 FlashRec 引擎接入一个新模型架构(新的 HF checkpoint / 非 Qwen3 结构)。涵盖模型定义、权重合并加载、FP8 双路径、融合 kernel 接线、CUDA graph 兼容、精度校验、以及压测+trace 验证闭环。当用户要"增加/支持/接入新模型"时使用。. Add Model is an agent skill from sohu-mptc/FlashRec.
Add Model fits situations like: AI & LLM Engineering work in your project.
Run `npx skills add sohu-mptc/FlashRec --skill add-model -a claude-code`. Or copy the skill folder (.claude/skills/add-model in sohu-mptc/FlashRec) into .claude/skills/add-model in your project. Claude Code loads it when a task matches its description.
Run `npx skills add sohu-mptc/FlashRec --skill add-model -a codex`. Or copy the skill folder (.claude/skills/add-model in sohu-mptc/FlashRec) into .agents/skills/add-model in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sohu-mptc/FlashRec --skill add-model -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-model, .gemini/skills/add-model, .github/skills/add-model and .opencode/skills/add-model in your project.
Going by SKILL.md and its folder, Add Model needs the command-line tools its instructions call (python and curl). Our summary lists: Python 3.
SKILL.md names 1 domain. As links in the text: ui.perfetto.dev. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Add Model is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Add Model: Paddle Build (PaddlePaddle/Paddle, 24k stars), Paddle Design Compiler (PaddlePaddle/Paddle, 24k stars), Qwen Mtp Gguf (R6410418/Jackrong-llm-finetuning-guide, 1.7k stars) and Pocketmen With You (six-nut/PocketMen-with-you, 310 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
sohu-mptc (a GitHub organization) maintains it in sohu-mptc/FlashRec, which has 107 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 10, 2026.
Source: sohu-mptc/FlashRec on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.