prompting-tool-use-tokenization
Route Qwen system prompts, ReAct/tool use, OpenAI-style function calling, ChatML, special tokens, tokenizer safety, and BPE merge workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- prompting-tool-use-tokenization
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route Qwen system prompts, ReAct/tool use, OpenAI-style function calling, ChatML, special tokens, tokenizer safety, and BPE merge workflows.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/function-calling-and-react.md2.4 KB
- 参考文档references/system-prompts.md1.4 KB
- 参考文档references/tokenization-and-chatml.md2.0 KB
- 参考文档references/troubleshooting.md1.5 KB
- 脚本scripts/qwen_tokenizer_merge_helper.py3.4 KB
- 脚本scripts/validate_function_call_messages.py3.0 KB
03 SKILL.md 正文
Qwen Prompting, Tool Use, and Tokenization
Use this sub-skill when the user wants Qwen-specific system prompts, ReAct prompting, OpenAI-style function calling, Hugging Face Agent patterns, function-calling fine-tune samples, ChatML behavior, special-token safety, or tokenizer BPE merge extension.
Safe start
- Use
scripts/validate_function_call_messages.pybefore debugging a function-calling request or fine-tune sample. - Use
scripts/qwen_tokenizer_merge_helper.pyfor a safe local BPE-merge helper when extending tokenizer merge files. - Keep prompt/tool behavior separate from model loading and server launch.
Routes
| User request | Read |
|---|---|
| System prompts, role/language/task/behavior control, or stable assistant behavior across turns | references/system-prompts.md |
ReAct template, function schemas, OpenAI-compatible message conversion, Observation: stop words, fine-tune samples for function calling |
references/function-calling-and-react.md |
| ChatML roles, `< | im_start |
| Invalid role order, streaming function calls, tokenizer decode issues, special-token injection, or fine-tune sample mistakes | references/troubleshooting.md |
Boundaries
- For loading a model before calling
chat, use../inference-model-loading/SKILL.md. - For launching an OpenAI-compatible server, use
../serving-deployment/SKILL.md. - For fine-tuning command plans, use
../finetuning-quantization/SKILL.md. - For plugin/tool benchmark reproduction, use
../evaluation-reproduction/SKILL.md.
Operating rules
- Qwen's OpenAI-style function calling is implemented through ReAct text conversion, not through a separate hidden tool runtime.
- The local API server rejects function calling with streaming; route users to non-streaming requests when
functionsare present. - Do not allow untrusted text containing special-token surface forms to be treated as control tokens unless the user deliberately wants that behavior.
- Do not add ordinary vocabulary tokens casually; Qwen's tokenizer documentation discourages adding regular tokens and preserves extra special tokens for controlled uses.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).