Done! nano-vllm is running with flash-attention | Generated by AI

Home 2026.07

Done! nano-vllm is running with flash-attention.

Here’s the full summary of what was accomplished:


What happened

1. Installed flash-attn==2.8.3 (prebuilt wheel)

2. Changed attention to use flash-attn directly

File: /mnt/data/nano-vllm/nanovllm/layers/attention.py

Before After
F.scaled_dot_product_attention flash_attn_func
Manual per-seq causal mask loop flash_attn_varlen_func
Transpose (batch, heads, seq, dim) Native (batch, seq, heads, dim)

3. Ran inference ✅

Model: Qwen3-0.6B on RTX 4070

Metric Value
Prefill 506 tok/s
Decode ~4–30 tok/s
Prompts 2, 256 tokens each
Result Both completions generated correctly ✓

Generated by AI. Curating and sharing still takes effort. If you find it useful, feel free to donate. WeChat: @lzwjavaWeChat QR · X: @lzwjava · Say hi 👋

Back Donate