Text Generation
PEFT
Safetensors
GGUF
Korean
English
function-calling
tool-use
korean
qlora
conversational
Instructions to use mengbau/toolRouter-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use mengbau/toolRouter-1B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/llama-3.2-1b-instruct-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "mengbau/toolRouter-1B") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mengbau/toolRouter-1B with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mengbau/toolRouter-1B:Q4_K_M # Run inference directly in the terminal: llama cli -hf mengbau/toolRouter-1B:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mengbau/toolRouter-1B:Q4_K_M # Run inference directly in the terminal: llama cli -hf mengbau/toolRouter-1B:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf mengbau/toolRouter-1B:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf mengbau/toolRouter-1B:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf mengbau/toolRouter-1B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf mengbau/toolRouter-1B:Q4_K_M
Use Docker
docker model run hf.co/mengbau/toolRouter-1B:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use mengbau/toolRouter-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mengbau/toolRouter-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mengbau/toolRouter-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mengbau/toolRouter-1B:Q4_K_M
- Ollama
How to use mengbau/toolRouter-1B with Ollama:
ollama run hf.co/mengbau/toolRouter-1B:Q4_K_M
- Unsloth Desktop
- Pi
How to use mengbau/toolRouter-1B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mengbau/toolRouter-1B:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mengbau/toolRouter-1B:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use mengbau/toolRouter-1B with Docker Model Runner:
docker model run hf.co/mengbau/toolRouter-1B:Q4_K_M
- Lemonade
How to use mengbau/toolRouter-1B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mengbau/toolRouter-1B:Q4_K_M
Run and chat with the model
lemonade run user.toolRouter-1B-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use mengbau/toolRouter-1B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mengbau/toolRouter-1B:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mengbau/toolRouter-1B:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mengbau/toolRouter-1B with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mengbau/toolRouter-1B:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mengbau/toolRouter-1B:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
|
Download README.md from mengbau/toolRouter-1B: direct link, hf CLI and curl.
- Browser
- Download file 8.58 kB
-
https://huggingface.co/mengbau/toolRouter-1B/resolve/main/README.md
- Command line
-
hf download hf://mengbau/toolRouter-1B/README.md
-
curl -L -o README.md https://huggingface.co/mengbau/toolRouter-1B/resolve/main/README.md
8.58 kB
| base_model: meta-llama/Llama-3.2-1B-Instruct | |
| language: | |
| - ko | |
| - en | |
| library_name: peft | |
| pipeline_tag: text-generation | |
| tags: | |
| - function-calling | |
| - tool-use | |
| - korean | |
| - qlora | |
| # toolRouter-1B | |
| νκ΅μ΄ μ°μ **ν΄μ½ λΌμ°ν°** β μ¬μ©μ λ°νλ₯Ό λ°μ νμ ν΄μ½ νλλ‘ μλ΅νλ λΌμ°ν λͺ¨λΈμ λλ€. **Llama-3.2-1B-Instruct** μμ μΉλ QLoRA μ΄λν°(~45MB)λ‘, 4bit λ‘λ μ VRAM μ½ 2.5GB, GGUF Q4 λ³ν μ μ½ 1GBλ‘ κ΅¬λλ©λλ€. | |
| - μμ ν μ€νΈλ₯Ό μμ±νμ§ μμ΅λλ€. λͺ¨λ μΆλ ₯μ `<tool_call>{"name": ..., "arguments": {...}}</tool_call>` νμμ λλ€. | |
| - μΌλ° λνΒ·μμ μλ΅μ `reply(text=...)`, μ²λ¦¬ λΆκ° μμ²μ `escalate(query=μλ¬Έ)` ν΄λ‘ ννν©λλ€. | |
| - μΈμλ μ¬μ©μ λ¬Έμ₯μ ννμ μλ¬Έ κ·Έλλ‘ μΆμΆνλλ‘ νμ΅λμ΅λλ€ (νκ΅μ΄ μΈμμ μμ΄ λ²μΒ·μμ½Β·μ§μ΄λ μ΅μ ). | |
| - μ²μ 보λ ν΄ μ€ν€λ§(zero-shot toolset)μμλ λμνλλ‘ νμ΅λμ΅λλ€. | |
| - λ©ν°ν΄μ΄ νμνλ©΄ [recallResolver-1B](https://huggingface.co/kimjg/recallResolver-1B)μ μ§μΌλ‘ μ°μΈμ β κ°μ λ² μ΄μ€λ₯Ό 곡μ ν΄ μ΄λν° μ νλ§μΌλ‘ ν¨κ» λμνλ©°, λͺ¨λΈμ λ°λ‘ λμ°λ κ² λλΉ VRAMμ΄ μ λ°μ λλ€ β μ€μΈ‘: llama.cpp λ² μ΄μ€ Q4 + LoRA 2κ° ν μλ² = **1.5GB**, λ¨Έμ§ Q4 μλ² 2κ° = 2.8GB (κ° 2048 ctx, μΆλ‘ λ²νΌ ν¬ν¨). | |
| ## μ΅μ λ²μ β 2026-09.2 (recall μ§μ) | |
| νκ΅μ΄ μ€μ¬μ© 문체 6,000λ¬Έμ₯ μ§μ μμ± λ°μ΄ν°λ‘ κ°ννκ³ , **κ³Όκ±° λν μ°Έμ‘° κ°μ§(`recall`)**λ₯Ό μΆκ°ν λ²μ μ λλ€. | |
| | νκ° | μμΉ | | |
| |---|---| | |
| | νκ΅μ΄ νκ°μ 396 (decision / tool / args) | 97.2 / 95.7 / 83.8 | | |
| | held-out 1,100 (decision / tool / args) | 99.5 / 99.2 / 97.0 | | |
| | BFCL v3 single-turn (simple / multiple / irrelevance / overall) | 86.0 / 85.5 / 80.0 / **84.2** | | |
| | recall νμ (κ²½κ³ μΌμ΄μ€ ν¬ν¨ 120) | μ¬ν 86.7% / μ λ° 91.2% / ν¨μ λ°©μ΄ 52/55 | | |
| ## μ¬μ©λ² | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| from peft import PeftModel | |
| base = "meta-llama/Llama-3.2-1B-Instruct" | |
| model = AutoModelForCausalLM.from_pretrained(base, device_map="auto") | |
| model = PeftModel.from_pretrained(model, "kimjg/toolRouter-1B") | |
| tokenizer = AutoTokenizer.from_pretrained("kimjg/toolRouter-1B") | |
| ``` | |
| μ±ν ν νλ¦Ώμ μ μ₯μμ `chat_template.jinja`μ ν¬ν¨λΌ μμ΅λλ€. greedy λμ½λ©μ κΆμ₯νλ©°, νλ‘λμ μμλ xgrammar λ± JSON μ€ν€λ§ λ¬Έλ² κ°μ (constrained decoding)λ₯Ό ν¨κ» μ°λ©΄ νμ±Β·μ€ν€λ§ ν΅κ³Όμ¨ 100%λ₯Ό 보μ₯ν μ μμ΅λλ€. | |
| ## ν΄ μ§μ λ°©λ² | |
| μμ€ν ν둬ννΈμ ν΄ μ€ν€λ§λ₯Ό **ν μ€μ νλμ© compact JSON**μΌλ‘ λμ΄ν©λλ€. νμ΅ λ μ¬μ©ν ν νλ¦Ώ κ·Έλλ‘ μ°λ κ²μ κΆμ₯ν©λλ€: | |
| ```text | |
| λλ κ²μ κ³΅λ΅ λμ°λ―Έμ ν΄μ½ λΌμ°ν°λ€. μ¬μ©μμ μμ²μ μ½κ³ μλ ν΄ μ€ μ νν νλλ₯Ό νΈμΆνλ κ²μΌλ‘λ§ μλ΅νλ€. μμ ν μ€νΈλ₯Ό μΆλ ₯νμ§ μλλ€. | |
| - μΌλ° λνλ μ§μ λ΅ν μ μλ μ§λ¬Έμ reply ν΄μ νΈμΆνλ€. | |
| - λͺ©λ‘μ μλ ν΄λ‘ μ²λ¦¬ν μ μκ±°λ λ²μλ₯Ό λ²μ΄λ μμ²μ escalate ν΄μ νΈμΆνλ€. | |
| - ν΄ μΈμλ μ¬μ©μμ μμ²μμ μΆμΆνλ€. μμ²μ μλ κ°μ μ§μ΄λ΄μ§ μλλ€. | |
| μλ΅ νμμ λ°λμ λ€μκ³Ό κ°λ€: | |
| <tool_call>{"name": "<ν΄ μ΄λ¦>", "arguments": {<μΈμ>}}</tool_call> | |
| μ¬μ© κ°λ₯ν ν΄ λͺ©λ‘: | |
| <tools> | |
| {tools_json} | |
| </tools> | |
| ``` | |
| `{tools_json}` μ리μ λ€μ΄κ°λ ν΄ μ€ν€λ§ νμ (OpenAI function μ€ν€λ§μ λμΌν `parameters` ꡬ쑰): | |
| ```json | |
| {"name": "get_weather", "description": "μ§μμ νμ¬ λ μ¨λ₯Ό μ‘°ννλ€", "parameters": {"type": "object", "properties": {"location": {"type": "string", "description": "λμ μ΄λ¦"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}}, "required": ["location"]}} | |
| {"name": "reply", "description": "ν΄μ΄ νμ μλ μ§λ¬Έμ μ§μ λ΅νλ€", "parameters": {"type": "object", "properties": {"text": {"type": "string"}}, "required": ["text"]}} | |
| {"name": "escalate", "description": "μ²λ¦¬ν μ μλ μμ²μ μμλ‘ λκΈ΄λ€", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}} | |
| ``` | |
| `reply`μ `escalate`λ νμ λͺ©λ‘μ ν¬ν¨ν΄μΌ ν©λλ€. λλ¨Έμ§ ν΄μ μμ λ‘κ² κ΅μ²΄ν μ μκ³ , νμ΅ λ λ³Έ μ μλ ν΄μ λ λμν©λλ€(zero-shot). ν΄ μ€λͺ μ μμ΄Β·νκ΅μ΄ λͺ¨λ μ§μν©λλ€. | |
| ## κΈ°λ³Έ ν΄ 3μ’ (λΌμ°ν°μ νλ‘ν μ½) | |
| μ΄ λΌμ°ν°λ "λͺ¨λ μλ΅μ΄ ν΄μ½"μ΄λΌλ κ·μ½ μμμ λμνλ©°, λλ©μΈ ν΄ μΈμ λ€μ κΈ°λ³Έ ν΄λ‘ λͺ¨λ λ°νλ₯Ό 컀λ²ν©λλ€: | |
| | κΈ°λ³Έ ν΄ | μΈμ λμ€λ | μΈμ | μλ²κ° ν μΌ | | |
| |---|---|---|---| | |
| | `reply` | ν΄μ΄ νμ μλ μΈμ¬Β·μ‘λ΄Β·μμ μ§λ¬Έ ("κ³ λ§μ!", "μλ ") | `text`: μ§§μ νκ΅μ΄ λ΅λ³ | textλ₯Ό κ·Έλλ‘ μ¬μ©μμκ² | | |
| | `escalate` | λͺ©λ‘μ ν΄λ‘ μ²λ¦¬ λΆκ°ν μμ² β λ€λ₯Έ λλ©μΈ, λ³΅ν© μμ , νμ μΈμλ₯Ό μ μ μμ, κΈ΄ κΈμ°κΈ° λ± | `query`: **μ¬μ©μ μμ² μλ¬Έ κ·Έλλ‘** | μμ λͺ¨λΈΒ·λ΄λΉμμκ² μ λ¬ | | |
| | `recall` | λ°νκ° κ³Όκ±° λνμ κ°μ κ°λ¦¬ν¬ λ ("κ·Έκ±° μ¬κ³ μΌλ§ λ¨μμ΄?", "μκΉ κ·Έ λμ λ΄μΌ λ μ¨λ?") | `needs`: μ°ΎμμΌ ν κ°μ νκ΅μ΄ μ€λͺ | [recallResolver-1B](https://huggingface.co/kimjg/recallResolver-1B)λ‘ νμ€ν 리μμ κ°μ μ°Ύμ λ°νλ₯Ό λ³΄κ° ν λΌμ°ν° μ¬νΈμΆ | | |
| μ€κ³ μλ: λΌμ°ν°λ μμ ν μ€νΈλ₯Ό μμ±νμ§ μμΌλ―λ‘ "λλ΅νλ€/λκΈ΄λ€/κ³Όκ±°λ₯Ό μ°Ύλλ€"κΉμ§ μ λΆ ν΄μ½λ‘ ννλ©λλ€. λλΆμ λ€μ΄μ€νΈλ¦Όμ λΆκΈ° μ²λ¦¬λ§ νλ©΄ λκ³ , μΆλ ₯ λ¬Έλ² κ°μ (constrained decoding)λ₯Ό μ 체 μλ΅μ μ μ©ν μ μμ΅λλ€. | |
| **reply μ΄μ© ν**: `reply.text`λ₯Ό κ·Έλλ‘ μΈ μλ μμ§λ§(μ§μ° μ΅μ), replyλ₯Ό **"λν νΈλ" μ νΈλ‘λ§ μ°κ³ λ°νλ₯Ό λ³λ μ± λͺ¨λΈλ‘ λκΈ°λ** ꡬμ±λ λΆκΈ° ν μ€μ΄λ©΄ λ©λλ€. νλ₯΄μλ μλ 본격 μ±λ΄κ³Ό λΆμΌ λ μ μ©ν©λλ€: | |
| ```python | |
| call = route(utterance) | |
| if call["name"] == "reply": | |
| return chat_model(persona, utterance) # textλ λ²λ¦¬κ³ ν° λͺ¨λΈμ΄ λν | |
| ``` | |
| > **recall μ°λ ν** (recallResolver-1Bμμ end-to-end κ²μ¦μμ νμ ν μλ² κ·μΉ): β 리쑸λ²κ° κ°μ μ°ΎμΌλ©΄ κ·Έ κ°μ μΆμ² μΈμ μ€ν€λ§ μ€λͺ μ λΌλ²¨λ‘ λ°νλ₯Ό 보κ°ν΄ μ¬λΌμ°ν β `"{λ°ν} ({λΌλ²¨}: {κ°})"` β‘λΌμ°ν°μ needsλ‘ λ¦¬μ‘Έλ²κ° λͺ» μ°ΎμΌλ©΄ ν΄λΉ κΈ°λ‘μ μΈμ μ€λͺ λ€λ‘ μ¬μ§μ β’needsμ κ° λΌλ²¨μ μ νμ΄ μ λ§μΌλ©΄ μλ μ£Όμ λμ μ¬μ©μμκ² νμΈ. μ¬νΈμΆμ΄ λ recallμ΄λ©΄ escalate(루ν κ°λ). recallμ μ°μ§ μμΌλ €λ©΄ ν΄ λͺ©λ‘μμ λΉΌλ©΄ λ©λλ€ β κ·Έλ¬λ©΄ κ³Όκ±° μ°Έμ‘° λ°νλ escalateλ‘ λμ΅λλ€. | |
| λμ μ: | |
| ```text | |
| user: μ°μ° μ±κ²¨μΌ νλ, λμ μΈλ° | |
| assistant: <tool_call>{"name": "get_weather", "arguments": {"location": "λμ "}}</tool_call> | |
| user: κ³ λ§μ! | |
| assistant: <tool_call>{"name": "reply", "arguments": {"text": "λ³λ§μμμ, λ νμνλ©΄ λΆλ¬ μ£ΌμΈμ!"}}</tool_call> | |
| user: μ΄ μ¬μ§μμ κΈμ μ’ μ½μ΄μ€ | |
| assistant: <tool_call>{"name": "escalate", "arguments": {"query": "μ΄ μ¬μ§μμ κΈμ μ’ μ½μ΄μ€"}}</tool_call> | |
| ``` | |
| ## GGUF (llama.cpp) | |
| μ΄λν°λ₯Ό λ¨Έμ§ν΄ μμνν λ¨μΌ νμΌλ μ 곡ν©λλ€. μμ€μ μ체 νκ°μ μ€μΈ‘μΉμ λλ€: | |
| | νμΌ | ν¬κΈ° | νκ΅μ΄ νκ°μ (decision/tool/args) | κΆμ₯ μ©λ | | |
| |---|---|---|---| | |
| | `toolRouter-1B-Q8_0.gguf` | 1.3GB | 96.5 / 95.0 / 83.4 (μλ³Έ λλΉ ~-0.8%p) | νμ§ μ°μ | | |
| | `toolRouter-1B-Q4_K_M.gguf` | 0.8GB | 95.5 / 94.2 / 83.4 (~-1.6%p) | μ΅μ VRAM | | |
| ```bash | |
| llama-server -m toolRouter-1B-Q8_0.gguf -ngl 99 -c 2048 | |
| ``` | |
| μ±ν ν νλ¦Ώμ΄ GGUFμ ν¬ν¨λΌ μμ΅λλ€. greedy(temperature 0) κΆμ₯, μΆλ ₯μ `<tool_call>...</tool_call>` νμ κ·Έλλ‘μ λλ€. recall νμ μ μμνμ λ€μ λ―Όκ°νλ(κ²½κ³ μΌμ΄μ€ -4~5%p) recallμ μ°λ νμ΄νλΌμΈμ΄λ©΄ Q8μ κΆν©λλ€. | |
| ## μ ν | |
| - λ¨μΌ ν΄ λΌμ°ν μ μ©μ λλ€ (λ©ν°ν΄ λ¬Έλ§₯ μ°Έμ‘°λ λ―Έμ§μ). | |
| - μΈκ³μ§μ μΆλ‘ μ΄ νμν μΈμ 보μ (μ: λμλͺ βν΅νμ½λ), μλ λ μ§ ν΄μμ λ€μ΄μ€νΈλ¦Όμμ μ²λ¦¬νμΈμ. μλ λ μ§λ μμ€ν ν둬ννΈμ νμ¬ λ μ§λ₯Ό μ 곡νλ©΄ κ°μ λ©λλ€. | |
| - base λͺ¨λΈμ Llama 3.2 Community Licenseλ₯Ό λ°λ¦ λλ€. | |