nano-vllm
Use nano-vLLM for CUDA-backed offline Qwen3 text generation, batched inference, KV-cache and tensor-parallel tuning, throughput benchmarking, or maintenance of its lightweight vLLM-like runtime.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- nano-vllm
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use nano-vLLM for CUDA-backed offline Qwen3 text generation, batched inference, KV-cache and tensor-parallel tuning, throughput benchmarking, or maintenance of its lightweight vLLM-like runtime.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/repo-provenance.md1.5 KB
- 参考文档references/repo-routing-metadata.json344 B
- 参考文档references/troubleshooting.md3.4 KB
- 脚本scripts/check_env.py4.1 KB
03 SKILL.md 正文
nano-vLLM
nano-vLLM is a small, Qwen3-focused inference engine whose public entry points
are nanovllm.LLM and nanovllm.SamplingParams. Use this skill for local,
offline generation or for understanding/tuning the engine. It is not a generic
Transformers model runner: the implementation initializes CUDA/NCCL and uses
Triton plus FlashAttention, so a CPU-only environment is not a full substitute.
Choose a route
- Generate text from local weights: read sub-skills/offline-inference/SKILL.md. It covers model-directory checks, chat templates, prompt batching, sampling, output records, and the bundled generation wrapper.
- Tune memory, batching, CUDA graphs, tensor parallelism, or throughput: read sub-skills/performance-tuning/SKILL.md.
- Modify or diagnose Qwen3 layers, safetensors loading, attention context, or tensor-parallel implementation: read sub-skills/model-internals/SKILL.md.
Read references/troubleshooting.md before changing dependencies or interpreting a hang/OOM. Read references/repo-provenance.md when deciding whether this skill matches a checkout or whether a refresh is needed.
Install and inspect
Use Python 3.10–3.12 and a CUDA-capable PyTorch environment. Install the
published dependency set, including a compatible flash-attn build, then
install nano-vLLM from the published Git repository or from a local checkout:
python -m pip install "torch>=2.4.0" "triton>=3.0.0" "transformers>=4.51.0" flash-attn xxhash
python -m pip install git+https://github.com/GeeeekExplorer/nano-vllm.git
For a checkout, an editable install is useful during development:
python -m pip install -e .
Run the bundled read-only probe before loading weights:
python scripts/check_env.py
The probe reports package imports, CUDA visibility, and FlashAttention without
constructing a model. Full inference additionally needs a local Hugging Face
Qwen3-format directory containing configuration, tokenizer files, and
safetensors weights; the engine does not download weights itself.
Shared operating rules
- Validate the model directory and CUDA stack before constructing
LLM. - Start with
enforce_eager=Truewhile diagnosing correctness or CUDA-graph capture failures; restore graph capture only after a stable smoke run. - Use
tensor_parallel_size=1first. Larger values require NCCL, visible GPUs, a localhost rendezvous, and dimensions divisible by the world size. - Keep
max_model_len, batching limits, andgpu_memory_utilizationwithin available VRAM. A failure while allocating KV cache is a capacity/config failure, not a prompt-format failure. - Prefer a list of
SamplingParamswhen requests need different temperatures or token budgets. Results preserve request order and containtextandtoken_idsfields. - Exit cleanly after inference when embedding the engine in a longer process; the engine registers an exit handler, but explicit lifecycle management is safer around multiprocessing.
The generated runtime tree is self-contained. The source repository snapshot, coverage decisions, and verification artifacts are intentionally kept outside this runtime directory.
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).