Cialtion commited on
Commit
c0f89b0
Β·
verified Β·
1 Parent(s): 4fe9df7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +280 -24
README.md CHANGED
@@ -1,36 +1,292 @@
1
- # SimpleTool: Parallel Decoding for Real-Time LLM Function Calling
 
 
 
2
 
3
- [**Hugging Face**](https://huggingface.co/Cialtion/SimpleTool) | [**ModelScope**](https://www.modelscope.cn/models/cialtion/SimpleTool) | [**GitHub**](https://github.com/HaxxorCialtion/SimpleTool)
 
 
4
 
5
- This repository contains the weights for **RT-Qwen** (RealtimeTool), a series of models optimized for low-latency, parallel LLM function calling.
 
 
 
 
 
 
 
6
 
7
- ## πŸ“ Model Directory Structure
 
 
8
 
9
- The models are organized by scale, quantization format, and inference framework.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- ### 1. SFT & AWQ Models (vLLM / Transformers)
12
- Directly use these folders for inference via `vLLM` or `Transformers`.
13
- * **RT-Qwen2.5-0.5B** / **-0.5B-AWQ**
14
- * **RT-Qwen2.5-1.5B** / **-1.5B-AWQ**
15
- * **RT-Qwen2.5-3B** / **-3B-AWQ**
16
- * **RT-Qwen2.5-7B** / **-7B-AWQ**
17
- * **RT-Qwen2.5-14B** / **-14B-AWQ**
18
- * **RT-Qwen3-4B** / **-4B-AWQ**
19
- * **RT-Qwen3-30B** / **-30B-AWQ**
20
 
21
- ### 2. GGUF Models (llama.cpp)
22
- * **`gguf_models/`**: Full-precision (F16) GGUF files for all versions.
23
- * **`gguf_quantized/`**: Quantized GGUF versions including **Q4_K_M**, **Q5_K_M**, and **Q8_0**.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  ---
26
 
27
- ## πŸ“ TODO
28
 
29
- - [ ] Release Arxiv Paper
30
- - [ ] Complete GitHub Documentation
31
- - [ ] Add Performance Benchmarks
32
- - [ ] Provide Citation Info
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  ---
35
- **License**: Apache-2.0
36
- **Status**: Models Uploading / Placeholder README
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center">
2
+ <a href="README.md">English</a> | <a href="README_zh.md">δΈ­ζ–‡</a>
3
+ </p>
4
+ <h1 align="center">SimpleTool</h1>
5
 
6
+ <p align="center">
7
+ <b>Parallel Decoding for Real-Time LLM Function Calling</b>
8
+ </p>
9
 
10
+ <p align="center">
11
+ <a href="https://arxiv.org/abs/2603.00030"><img src="https://img.shields.io/badge/arXiv-2603.00030-red"></a>
12
+ <a href="https://huggingface.co/Cialtion/SimpleTool"><img src="https://img.shields.io/badge/πŸ€—-Models-yellow"></a>
13
+ <a href="https://www.modelscope.cn/models/cialtion/SimpleTool"><img src="https://img.shields.io/badge/ModelScope-Models-blue"></a>
14
+ <a href="#demo-videos"><img src="https://img.shields.io/badge/Bilibili-Demo-00A1D6?logo=bilibili&logoColor=white"></a>
15
+ <a href="#demo-videos"><img src="https://img.shields.io/badge/YouTube-Demo-FF0000?logo=youtube&logoColor=white"></a>
16
+ <a href="#license"><img src="https://img.shields.io/badge/License-Apache%202.0-green"></a>
17
+ </p>
18
 
19
+ <p align="center">
20
+ A 4B-parameter LLM achieving <b>16 Hz end-to-end real-time function calling</b> β€” fast enough to drive game AI, robotic arms, and digital humans.
21
+ </p>
22
 
23
+ ---
24
+
25
+ SimpleTool enables **real-time LLM function calling** through multi-head parallel decoding. By introducing special tokens that compress redundant structured output (4–6Γ—) and enable independent generation of function name and arguments, we achieve **3–6Γ— end-to-end speedup** while maintaining competitive accuracy across three application domains: **games**, **robotic control**, and **digital human animation**.
26
+
27
+ <p align="center">
28
+ <img src="assets/fig_title_panel_a.png" alt="SimpleTool Overview" width="700">
29
+ </p>
30
+
31
+ ## How It Works
32
+
33
+ Traditional function calling generates tokens sequentially β€” `function β†’ arg1 β†’ arg2 β†’ ...` β€” so latency scales linearly with output length. SimpleTool exploits two key observations:
34
+
35
+ 1. **Token Redundancy**: Structured outputs contain predictable tokens (brackets, parameter names, quotes) that can be compressed into single special tokens.
36
+ 2. **Weak Causal Dependencies**: Function arguments are largely independent of each other and can be generated in parallel.
37
+
38
+ <p align="center">
39
+ <img src="assets/overview.png" alt="SimpleTool Architecture" width="600">
40
+ </p>
41
+
42
+ By decoding function name and arguments as parallel streams sharing the same prefix KV cache, latency drops from `sum(all_token_times)` to `max(per_head_time)`. The parallel heads utilize idle compute capacity within the memory-bandwidth-bound decode phase, making parallelization nearly free.
43
+
44
+ For more details, see our [arXiv paper](https://arxiv.org/abs/2603.00030).
45
+
46
+ ---
47
+
48
+ ## Quick Start
49
+
50
+ ### 1. Setup Environment
51
+
52
+ ```bash
53
+ git clone https://github.com/HaxxorCialtion/SimpleTool.git
54
+ cd SimpleTool
55
+ ```
56
+
57
+ **Option A β€” uv (recommended)**
58
+ ```bash
59
+ uv venv env_rt -p python3.12
60
+ source env_rt/bin/activate
61
+ uv pip install -r requirements.txt
62
+ ```
63
+
64
+ **Option B β€” conda**
65
+ ```bash
66
+ conda create -n simpletool python=3.12 -y
67
+ conda activate simpletool
68
+ pip install -r requirements.txt
69
+ ```
70
+
71
+ **Option C β€” pip**
72
+ ```bash
73
+ python3.12 -m venv env_rt
74
+ source env_rt/bin/activate
75
+ pip install -r requirements.txt
76
+ ```
77
+
78
+ ### 2. Download Model
79
+
80
+ The recommended default model is **RT-Qwen3-4B-AWQ-v2** (4B parameters, AWQ W4A16 quantized, v2 prompt format). All scripts default to `./models/RT-Qwen3-4B-AWQ-v2`.
81
+
82
+ ```bash
83
+ # HuggingFace
84
+ huggingface-cli download Cialtion/SimpleTool \
85
+ --include "RT-Qwen3-4B-AWQ-v2/*" --local-dir ./models
86
+
87
+ # Or ModelScope
88
+ modelscope download --model cialtion/SimpleTool \
89
+ --include "RT-Qwen3-4B-AWQ-v2/*" --local_dir ./models
90
+ ```
91
+
92
+ <details>
93
+ <summary><b>All Available Models</b></summary>
94
+
95
+ | Model | Params | Latency | HuggingFace | ModelScope |
96
+ |-------|--------|---------|-------------|------------|
97
+ | RT-Qwen2.5-0.5B-AWQ | 0.5B | ~30ms | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen2.5-0.5B-AWQ) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen2.5-0.5B-AWQ) |
98
+ | RT-Qwen2.5-1.5B-AWQ | 1.5B | ~40ms | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen2.5-1.5B-AWQ) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen2.5-1.5B-AWQ) |
99
+ | RT-Qwen2.5-3B-AWQ | 3B | ~50ms | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen2.5-3B-AWQ) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen2.5-3B-AWQ) |
100
+ | **RT-Qwen3-4B-AWQ-v2** | **4B** | **~60ms** | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen3-4B-AWQ-v2) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen3-4B-AWQ-v2) |
101
+ | RT-Qwen3-4B-AWQ | 4B | ~60ms | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen3-4B-AWQ) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen3-4B-AWQ) |
102
+ | RT-Qwen2.5-7B-AWQ | 7B | ~70ms | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen2.5-7B-AWQ) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen2.5-7B-AWQ) |
103
+ | RT-Qwen2.5-14B-AWQ | 14B | ~130ms | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen2.5-14B-AWQ) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen2.5-14B-AWQ) |
104
+ | RT-Qwen3-30B-A3B-AWQ | 30B(A3B) | ~ | [πŸ€—](https://huggingface.co/Cialtion/SimpleTool/tree/main/RT-Qwen3-30B_awq_w4a16) | [Link](https://www.modelscope.cn/models/cialtion/SimpleTool/tree/master/RT-Qwen3-30B_awq_w4a16) |
105
+
106
+ > Latency measured on RTX 4090 with vLLM prefix caching. v2 models use an improved prompt format with domain-specific system prompts; v1 models use a generic multi-head instruction header.
107
+
108
+ </details>
109
+
110
+ ### 3. Run Benchmark (No Server Needed)
111
+
112
+ `01_benchmark.py` runs multi-head parallel decoding directly via vLLM across three application domains β€” game AI, robotic arm control, and digital human animation β€” with cold start / hot prefill / decode bottleneck analysis.
113
+
114
+ ```bash
115
+ # v2 model (default)
116
+ python 01_benchmark.py --version v2
117
+
118
+ # v1 model
119
+ python 01_benchmark.py --version v1 --model ./models/RT-Qwen3-4B-AWQ
120
+
121
+ # Auto-detect optimal head count per scenario
122
+ python 01_benchmark.py --n-args auto
123
+ ```
124
+
125
+ Example output:
126
+ ```
127
+ PARALLEL TEST (v2)
128
+
129
+ ─── Game β€” Tower Defense ───
130
+ PASS use_skill(Amiya)
131
+ function use_skill 4 OK
132
+ arg1 Amiya 4 FILL
133
+ arg2 <|null|> 3 NULL
134
+ e2e=24.6ms max_tok=4
135
+
136
+ ─── Robotic Arm β€” Assembly ───
137
+ PASS move_to(300,150,50,slow)
138
+ function move_to 4 OK
139
+ arg1 300 5 FILL
140
+ arg2 150 5 FILL
141
+ arg3 500 5 FILL
142
+ arg4 slow 3 FILL
143
+ e2e=39.9ms max_tok=5
144
+
145
+ ─── Digital Human β€” Streamer ───
146
+ PASS speak(welcome,cheerful)
147
+ function speak 4 OK
148
+ arg1 Welcome! 4 FILL
149
+ arg2 cheerful 5 FILL
150
+ e2e=29.1ms max_tok=5
151
 
152
+ SUMMARY (v2)
153
+ Accuracy : 3/3
154
+ Cold start avg : 56.1ms
155
+ Hot prefill avg: 29.3ms
156
+ E2E avg (hot) : 31.2ms
157
+ E2E / max_tok : 6.7ms/tok (decode bottleneck)
158
+ ```
 
 
159
 
160
+ The script also prints the full prompt structure and reconstructed multi-head output for inspection.
161
+
162
+ ### 4. Start Server
163
+
164
+ `02_server.py` wraps the engine in a FastAPI server with CORS support. HTML game clients connect to it.
165
+
166
+ ```bash
167
+ python 02_server.py
168
+ ```
169
+
170
+ Server starts at `http://localhost:8899` with two endpoints:
171
+
172
+ | Endpoint | Method | Description |
173
+ |----------|--------|-------------|
174
+ | `/health` | GET | Health check, model version info |
175
+ | `/v1/function_call` | POST | Multi-head parallel function call |
176
+
177
+ Edit `MODEL_PATH` and `MODEL_VERSION` at the top of `02_server.py` to switch between v1/v2 models.
178
+
179
+ ### 5. Test Server
180
+
181
+ With the server running, test it from another terminal:
182
+
183
+ ```bash
184
+ python 03_test_server.py
185
+ ```
186
+
187
+ This sends the same three domain scenarios (game, robotic arm, digital human) to the server API and reports accuracy, cold/hot latency, and per-head output.
188
+
189
+ ```bash
190
+ # Custom server URL
191
+ python 03_test_server.py --url http://192.168.1.100:8899
192
+
193
+ # More hot rounds
194
+ python 03_test_server.py --rounds 10
195
+ ```
196
+
197
+ ### 6. Play Demos
198
+
199
+ Open demo HTML files in your browser. They connect to the running SimpleTool server.
200
+
201
+ | Demo | Description | File |
202
+ |------|-------------|------|
203
+ | **Pong** | AI vs Human paddle game | `demos/pong_game.html` |
204
+ | **Neon Arena** | Multi-AI battle shooter | `demos/neon_arena.html` |
205
+
206
+ For games with extra assets:
207
+ ```bash
208
+ cd demos/neon_arena
209
+ python3 -m http.server 8080 --bind 127.0.0.1
210
+ ```
211
+ Then open http://127.0.0.1:8080/neon_arena.html and enter your SimpleTool server URL (default: `http://localhost:8899`).
212
+
213
+ <p align="center">
214
+ <video src="https://github.com/user-attachments/assets/436e3b97-e8ab-4d36-9fa0-8f1962da4a38" autoplay loop muted width="400"></video>
215
+ <video src="https://github.com/user-attachments/assets/f9b127da-b65e-4a06-b48f-836e759a6029" autoplay loop muted width="400"></video>
216
+ </p>
217
 
218
  ---
219
 
220
+ ## Project Structure
221
 
222
+ ```
223
+ SimpleTool/
224
+ β”œβ”€β”€ 01_benchmark.py # Step 1: Direct parallel decode benchmark
225
+ β”œβ”€β”€ 02_server.py # Step 2: FastAPI vLLM server
226
+ β”œβ”€β”€ 03_test_server.py # Step 3: Server API test client
227
+ β”œβ”€β”€ prompts/ # External prompt & scenario files
228
+ β”‚ β”œβ”€β”€ v1_system.txt # v1 multi-head system prompt
229
+ β”‚ β”œβ”€β”€ scenarios.json # 3 domain test scenarios
230
+ β”‚ β”œβ”€β”€ tools_game.jsonl # Tower defense tool definitions
231
+ β”‚ β”œβ”€β”€ tools_arm.jsonl # Robotic arm tool definitions
232
+ β”‚ └── tools_avatar.jsonl # Digital human tool definitions
233
+ β”œβ”€β”€ models/ # Downloaded models go here
234
+ β”‚ └── RT-Qwen3-4B-AWQ-v2/ # Default model
235
+ β”œβ”€β”€ demos/ # HTML game clients
236
+ β”‚ β”œβ”€β”€ pong_game.html
237
+ β”‚ └── neon_arena/
238
+ β”œβ”€β”€ assets/ # Figures for README
239
+ β”œβ”€β”€ requirements.txt
240
+ β”œβ”€β”€ simpletool-game.skill.md # Guide for building new games with AI
241
+ β”œβ”€β”€ README.md
242
+ └── README_zh.md
243
+ ```
244
+
245
+ ## Build Your Own Game
246
+
247
+ Feed **`simpletool-game.skill.md`** along with this **`README.md`** into your AI coding agent (Claude Code, Codex, Antigravity, etc.) β€” the skill file covers server API spec, tool definition format, query design best practices, frontend templates, and dynamic head optimization tips, while the README helps the agent understand the overall project structure. Together they provide everything needed to vibe-code a SimpleTool-powered game.
248
 
249
  ---
250
+
251
+ ## Roadmap
252
+
253
+ - [ ] **World Simulation** β€” Large-scale (1,000+ NPCs) real-time AI world simulation with < 200ms action latency per agent
254
+ - [ ] **Native Windows Support** β€” Windows game engine plugins and native runtime(no need for docker or wsl)
255
+ - [ ] **Apple Ecosystem** β€” Mac and iPhone on-device deployment (CoreML / Metal)
256
+ - [ ] **v3 Architecture** β€” Fast thinking (real-time SimpleTool) + slow thinking (async meta-cognition) fusion
257
+ - [ ] **Embodied Intelligence** β€” Virtual 3D digital humans, large-scale game engine integration demos
258
+ - [ ] **Open Source Training** β€” Full training code and dataset release
259
+
260
+ ---
261
+
262
+ ## Demo Videos
263
+
264
+ <p align="center">
265
+ <a href="#"><img src="https://img.shields.io/badge/Bilibili-Demo-00A1D6?logo=bilibili&logoColor=white"></a>
266
+ <a href="#"><img src="https://img.shields.io/badge/YouTube-Demo-FF0000?logo=youtube&logoColor=white"></a>
267
+ </p>
268
+
269
+ > Video demos coming soon β€” showcasing real-time game AI, robotic arm control, and digital human animation.
270
+
271
+ ---
272
+
273
+ ## Citation
274
+
275
+ ```bibtex
276
+ @article{shi2026simpletool,
277
+ title={SimpleTool: Parallel Decoding for Real-Time LLM Function Calling},
278
+ author={Shi, Xiaoxin and Wan, Jiaxin and Dong, Linkang and Jiang, Wei and Liu, Yue and Huang, Zengfeng},
279
+ journal={arXiv preprint arXiv:2603.00030},
280
+ year={2026}
281
+ }
282
+ ```
283
+
284
+ ## Contact
285
+
286
+ - **Email**: cialtion737410@sjtu.edu.cn / cialtion@outlook.com
287
+ - **QQ Group**: 861244702
288
+ - **Bilibili**: [Cialtion](https://space.bilibili.com/Cialtion)
289
+
290
+ ## License
291
+
292
+ Apache 2.0