wangrunji0408

Qwen3 Rs — Development skill for Claude Code

Development community

A Qwen3.5 inference engine built by a group of agents on Slock.

How to install Qwen3 Rs

This entry records only its repository, not the path inside it, so there is no exact command to give. Open wangrunji0408/qwen3-rs and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Qwen3 Rs does

A Qwen3.5 inference engine built by a group of agents on Slock.

Alternatives in Development

  • IPolloWork — Enterprise-grade, local-first Agent Workbench for people and agent teams 4.9k ★
  • Magnitude — Open source inference server your agent sets up for you 1.5k ★
  • Haft — Engineering decisions engine that know when they're stale 1.4k ★

README

qwen3-rs

Qwen3.5 推理引擎,纯 Rust 实现,针对 Apple Silicon (M1) 优化。

本项目由一群 [Claude Sonnet](https://www.anthropic.com/claude) Agent 在 [Slock](https://slock.ai) 平台上协作完成。

![Slock 协作平台](slock.png)

性能(M1 Pro)

模型 Prefill Decode
Qwen3.5-0.8B ~234 tok/s ~21 tok/s
Qwen3.5-9B ~52 tok/s ~2.4 tok/s
Ollama 基准 (qwen3.5:0.8b-bf16) 231 tok/s 35 tok/s

前置条件

  • macOS(Apple Silicon M1)
  • Rust 1.85+
  • Qwen3.5 模型文件(safetensors 格式)

下载模型

# 0.8B 模型
huggingface-cli download Qwen/Qwen3.5-0.8B \
  --local-dir ~/Models/Qwen3.5-0.8B \
  --include "*.json" "*.safetensors" "tokenizer*"

# 9B 模型
huggingface-cli download Qwen/Qwen3.5-9B \
  --local-dir ~/Models/Qwen3.5-9B \
  --include "*.json" "*.safetensors" "tokenizer*"

编译

cargo build --release

使用

交互式对话

./target/release/qwen3-rs chat \
  --model ~/Models/Qwen3.5-0.8B \
  --max-tokens 512 \
  --temperature 0.7 \
  --thinking

文本生成

./target/release/qwen3-rs generate \
  --model ~/Models/Qwen3.5-0.8B \
  --prompt "What is 2+2?" \
  --max-tokens 50

性能测试

./target/release/qwen3-rs benchmark \
  --model ~/Models/Qwen3.5-0.8B \
  --prefill-len 64 \
  --decode-len 50

正确性验证

./target/release/qwen3-rs verify --model ~/Models/Qwen3.5-0.8B

运行测试

QWEN_MODEL_DIR=~/Models/Qwen3.5-0.8B cargo test

项目结构

src/
├── main.rs          # CLI 入口(generate / benchmark / verify / chat)
├── config.rs        # 模型配置
├── loader.rs        # safetensors 权重加载(mmap 零拷贝)
├── tokenizer.rs     # 分词器封装
├── inference.rs     # 推理主循环(prefill + decode)
├── sampling.rs      # 采样(greedy / temperature)
├── model/
│   ├── text.rs      # 完整 Transformer 模型
│   ├── attention.rs # 全注意力层(GQA + MRoPE)
│   ├── gated_delta_net.rs  # GatedDeltaNet 线性注意力层
│   ├── cache.rs     # KV cache
│   ├── rope.rs      # RoPE 旋转位置编码
│   └── vision.rs    # 视觉编码
└── ops/
    ├── blas.rs      # BLAS(Accelerate + NEON BF16 G