hotdogs's picture
Upload README.md with huggingface_hub
8984017 verified
|
Raw
History Blame Contribute Delete
9.69 kB
---
license: agpl-3.0
language:
- en
- th
tags:
- qwen
- agent
- tool-call
- tool-use
- function-calling
- reasoning
- opus
- fable
- conversational
- mtp
- multi-token-prediction
- transformers
- text-generation
- thai
- speculative-decoding
- preview
base_model:
- Qwen/Qwen3.6-27B
datasets:
- hotdogs/uka-fable-reasoning
- NousResearch/hermes-function-calling-v1
- 11-47/claude_opus_4.8_max_thinking_5k_v2
library_name: transformers
pipeline_tag: text-generation
---
<h1 align="center">πŸ‰ qwen27b-agent-R2-preview</h1>
<p align="center">
<b>27B Agent Model β€” MTP Β· Tool-Calling Β· Multi-LoRA Fusion</b>
</p>
<p align="center">
<img src="https://img.shields.io/badge/license-AGPL--3.0-red">
<img src="https://img.shields.io/badge/Qwen3.6-27B-blue">
<img src="https://img.shields.io/badge/MTP-Draft--2--token-brightgreen">
<img src="https://img.shields.io/badge/Multi--LoRA-Fusion-orange">
<img src="https://img.shields.io/badge/Preview-v0.1-yellow">
</p>
<br>
> **Preview release** β€” Built on Qwen3.6-27B with multi-LoRA fusion. Features **Multi-Token Prediction (MTP)** for speculative decoding, **tool-calling**, and **Opus + Fable** reasoning. Standard (non-abliterated) version.
---
## ✨ Key Features
| Capability | Description |
|------------|-------------|
| ⚑ **MTP Speculative Decoding** | Draft 2 tokens at a time β€” up to **+85% decode TPS** on single GPU |
| πŸ”§ **Tool Calling** | Hermes/Qwen function-calling format via llama.cpp `--tools all` |
| 🧠 **Reasoning** | Opus 4.8 + Fable-style reasoning with step-by-step CoT |
| 🌏 **Thai + English** | Native bilingual support |
| πŸ’» **Code** | Python, shell, system tasks |
---
## πŸš€ Usage
### llama.cpp (Recommended)
```bash
# Quick test
./llama-cli -m qwen27b-agent-R2-preview.Q4_K_M.gguf \
-p "Hello" -n 100 --temp 0.6
# Full agent server with tool calling + MTP speculative decoding
./llama-server \
-m qwen27b-agent-R2-preview.Q4_K_M.gguf \
--host 0.0.0.0 \
--port 8081 \
-c 262144 \
-ngl 99 \
--cache-type-k bf16 \
--cache-type-v bf16 \
--flash-attn on \
--tools all \
--cont-batching \
--temp 0.6 \
--top-k 40 \
--top-p 0.9 \
--min-p 0.05 \
--repeat-penalty 1.03 \
--dry-multiplier 0 \
--verbose \
-n -1 \
--parallel 1 \
--jinja \
--dry-sequence-breaker none \
--spec-type draft-mtp \
--spec-draft-n-max 2
```
| Parameter | Purpose |
|-----------|---------|
| `--cache-type-k bf16` / `--cache-type-v bf16` | BF16 KV cache for quality |
| `--flash-attn on` | Flash attention for speed |
| `--tools all` | Enable tool/function calling |
| `--spec-type draft-mtp` | MTP speculative decoding (draft 2 tokens) |
| `--spec-draft-n-max 2` | Max 2 draft tokens per step |
| `--cont-batching` | Continuous batching for multi-turn |
| `--jinja` | Use Jinja2 chat template from GGUF |
### Python (Transformers)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"hotdogs/qwen27b-agent-R2-preview",
torch_dtype="auto",
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("hotdogs/qwen27b-agent-R2-preview")
messages = [{"role": "user", "content": "Hello"}]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, return_tensors="pt")
outputs = model.generate(inputs, max_new_tokens=256, temperature=0.6)
print(tokenizer.decode(outputs[0]))
```
---
## πŸ“¦ Downloads
| File | Size | Quant | Description |
|------|:----:|:-----:|-------------|
| `qwen27b-agent-R2-preview.Q4_K_M.gguf` | 16 GB | Q4_K_M | **Recommended** β€” balanced quality/speed |
| `qwen27b-agent-R2-preview.Q6_K.gguf` | 21 GB | Q6_K | Higher quality, slightly slower |
| `qwen27b-agent-R2-preview.f16.gguf` | 51 GB | f16 | Full precision |
> 🎯 **Q4_K_M is recommended** for most users β€” good quality with 16 GB VRAM usage.
### πŸ“· Multimodal Projector (mmproj)
For vision support, pair this model with the mmproj from `Qwen/Qwen3.6-27B`:
```bash
# Extract mmproj from Qwen3.6-27B vision model
python3 ./llama.cpp/convert_hf_to_gguf.py \
--mmproj Qwen/Qwen3.6-27B \
--outfile mmproj-qwen3.6-27b.gguf
# Use with llama-server for vision + tool calling
./llama-server \
-m qwen27b-agent-R2-preview.Q4_K_M.gguf \
--mmproj mmproj-qwen3.6-27b.gguf
```
---
## 🧬 Architecture
| Parameter | Value |
|-----------|:-----:|
| Base | [Qwen/Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B) |
| Parameters | ~27B |
| Hidden Size | 5,120 |
| Attention | Linear + Standard hybrid |
| Context | 8,192 tokens (extendable) |
| Precision | BF16 / GGUF quantized |
| Format | ChatML (Jinja2 template) |
| MTP Head | βœ… 1 extra layer (draft 2 tokens) |
---
## 🧬 How This Model Was Built
```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ qwen27b-agent-R2-preview Construction β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ Qwen/Qwen3.6-27B (Base) β”‚
β”‚ β”‚ β”‚
β”‚ β”œβ”€β”€ Multi-LoRA Fusion (4 LoRAs): β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ β”‚ LoRa β”‚ Source β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚ β”‚ β”‚ Opus SFT β”‚ SFT on β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ Opus 4.8 β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚ β”‚ β”‚ CxCMU Agent β”‚ AgentWorld β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ trajectories β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚ β”‚ β”‚ General SFT β”‚ Reasoning β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ + Hermes FC β”‚ β”‚
β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚ β”‚ β”‚ Tachibana β”‚ Coding agent β”‚ β”‚
β”‚ β”‚ β”‚ Agent β”‚ dataset β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚ β”‚
β”‚ └── + MTP Head (15 tensors) β”‚
β”‚ └── From huihui-ai/Huihui-Qwen3.6-27B-abliterated β”‚
β”‚ β”‚
β”‚ Result: 866 tensors, MTP=1, 16.8 GB (Q4_K_M) β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
### Training Details
Each LoRA was trained independently via **SFT** on specialized datasets. Then all 4 were fused into the base model at their respective scales. The low scales (0.15-0.4) ensure no single LoRA overpowers the model β€” creating a balanced agent.
### MTP Tensor Injection
The Multi-Token Prediction head (15 tensors) was injected from `huihui-ai/Huihui-Qwen3.6-27B-abliterated` to enable speculative decoding:
```python
# MTP head adds blk.64.* tensors for draft-2-token prediction
--spec-type draft-mtp # Enables in llama.cpp
--spec-draft-n-max 2 # Max draft tokens
```
---
## ⚑ MTP Speculative Decoding
Multi-Token Prediction enables speculative decoding:
```
Standard: [token₁] β†’ [tokenβ‚‚] β†’ [token₃] β†’ ... (~36 TPS)
MTP: [token₁ tokenβ‚‚] β†’ [token₃ tokenβ‚„] β†’ ... (~66 TPS)
```
- MTP head adds ~849 MB to model size
- Uses `--spec-type draft-mtp` in llama.cpp
- Best for single-user agent workloads
- ~1.2–1.8Γ— decode speedup
---
## πŸ’– Support / ΰΉ‚ΰΈ›ΰΈ£ΰΈ”ΰΈͺΰΈ™ΰΈ±ΰΈšΰΈͺΰΈ™ΰΈΈΰΈ™
**If you find this model useful, please consider supporting my work!**
**ΰΈ«ΰΈ²ΰΈΰΈ„ΰΈΈΰΈ“ΰΈ„ΰΈ΄ΰΈ”ΰΈ§ΰΉˆΰΈ²ΰΉ‚ΰΈ‘ΰΉ€ΰΈ”ΰΈ₯ΰΈ™ΰΈ΅ΰΉ‰ΰΈ‘ΰΈ΅ΰΈ›ΰΈ£ΰΈ°ΰΉ‚ΰΈ’ΰΈŠΰΈ™ΰΉŒ กรุณาΰΈͺΰΈ™ΰΈ±ΰΈšΰΈͺΰΈ™ΰΈΈΰΈ™ΰΈœΰΈ₯ΰΈ‡ΰΈ²ΰΈ™ΰΈ‚ΰΈ­ΰΈ‡ΰΈ‰ΰΈ±ΰΈ™ΰΈ”ΰΉ‰ΰΈ§ΰΈ’ΰΈ™ΰΈ°ΰΈ„ΰΈ°! πŸ™**
<p align="center">
<img src="https://huggingface.co/hotdogs/Qwen35B-Agent-R2/raw/main/donate.webp" alt="Bitcoin QR β€” Donate" width="256">
</p>
### β‚Ώ Bitcoin β€” BTC:
```
bc1qf27cyk3vmugcdyv9xdtuv5jwz37863crpj5c9v
```
**Thank you for your support! πŸ™βœ¨**
**ΰΈ‚ΰΈ­ΰΈšΰΈ„ΰΈΈΰΈ“ΰΈ‘ΰΈ²ΰΈΰΉ† ΰΈͺำหรับการΰΈͺΰΈ™ΰΈ±ΰΈšΰΈͺΰΈ™ΰΈΈΰΈ™ΰΈ„ΰΉˆΰΈ²! πŸ’–πŸ€—**
---
## πŸ™ Acknowledgements / ΰΈ‚ΰΈ­ΰΈšΰΈ„ΰΈΈΰΈ“
- **[Qwen Team (Alibaba)](https://qwenlm.github.io)** β€” For the Qwen3.6 architecture
- **[Nous Research](https://nousresearch.com)** β€” For Hermes Agent framework
- **[huihui-ai](https://huggingface.co/huihui-ai)** β€” For MTP tensor support
- **All dataset contributors and the open-source AI community** ❀️
---
*Built with ❀️ by **UKA** β€” 18-year-old coder & cybersecurity expert*