Instructions to use badtheorylabs/BTL-4-Compact with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use badtheorylabs/BTL-4-Compact 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 badtheorylabs/BTL-4-Compact:IQ2_XXS # Run inference directly in the terminal: llama cli -hf badtheorylabs/BTL-4-Compact:IQ2_XXS
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf badtheorylabs/BTL-4-Compact:IQ2_XXS # Run inference directly in the terminal: llama cli -hf badtheorylabs/BTL-4-Compact:IQ2_XXS
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 badtheorylabs/BTL-4-Compact:IQ2_XXS # Run inference directly in the terminal: ./llama-cli -hf badtheorylabs/BTL-4-Compact:IQ2_XXS
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 badtheorylabs/BTL-4-Compact:IQ2_XXS # Run inference directly in the terminal: ./build/bin/llama-cli -hf badtheorylabs/BTL-4-Compact:IQ2_XXS
Use Docker
docker model run hf.co/badtheorylabs/BTL-4-Compact:IQ2_XXS
- LM Studio
- Jan
- vLLM
How to use badtheorylabs/BTL-4-Compact with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "badtheorylabs/BTL-4-Compact" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "badtheorylabs/BTL-4-Compact", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/badtheorylabs/BTL-4-Compact:IQ2_XXS
- Ollama
How to use badtheorylabs/BTL-4-Compact with Ollama:
ollama run hf.co/badtheorylabs/BTL-4-Compact:IQ2_XXS
- Unsloth Studio
How to use badtheorylabs/BTL-4-Compact with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for badtheorylabs/BTL-4-Compact to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for badtheorylabs/BTL-4-Compact to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for badtheorylabs/BTL-4-Compact to start chatting
- Pi
How to use badtheorylabs/BTL-4-Compact with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf badtheorylabs/BTL-4-Compact:IQ2_XXS
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "badtheorylabs/BTL-4-Compact:IQ2_XXS" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use badtheorylabs/BTL-4-Compact with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf badtheorylabs/BTL-4-Compact:IQ2_XXS
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 "badtheorylabs/BTL-4-Compact:IQ2_XXS" \ --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"
- Docker Model Runner
How to use badtheorylabs/BTL-4-Compact with Docker Model Runner:
docker model run hf.co/badtheorylabs/BTL-4-Compact:IQ2_XXS
- Lemonade
How to use badtheorylabs/BTL-4-Compact with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull badtheorylabs/BTL-4-Compact:IQ2_XXS
Run and chat with the model
lemonade run user.BTL-4-Compact-IQ2_XXS
List all available models
lemonade list
- Hermes Agent
How to use badtheorylabs/BTL-4-Compact with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf badtheorylabs/BTL-4-Compact:IQ2_XXS
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 badtheorylabs/BTL-4-Compact:IQ2_XXS
Run Hermes
hermes
- Atomic Chat
Upload eval/probe_tools.py with huggingface_hub
Browse files- eval/probe_tools.py +126 -0
eval/probe_tools.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Eyeball BTL-4 Compact's tool use before running the full BFCL gate.
|
| 3 |
+
|
| 4 |
+
Ten prompts covering the five behaviours BTL-3 Compact was scored on: a single
|
| 5 |
+
call, picking the right tool from several, two calls in parallel, two *different*
|
| 6 |
+
tools in parallel, and knowing when to make no call at all. Parallel-multiple is
|
| 7 |
+
the one to watch -- it was BTL-3 Compact's weakest category at 3/10.
|
| 8 |
+
|
| 9 |
+
Shares the system prompt and parser with bfcl_compact.py so what you see here is
|
| 10 |
+
what the benchmark will score.
|
| 11 |
+
|
| 12 |
+
python probe_tools.py # all ten
|
| 13 |
+
python probe_tools.py --ask "your question here"
|
| 14 |
+
"""
|
| 15 |
+
from __future__ import annotations
|
| 16 |
+
|
| 17 |
+
import argparse
|
| 18 |
+
import json
|
| 19 |
+
|
| 20 |
+
from bfcl_compact import REPO, FILENAME, SYS, parse_tool_calls
|
| 21 |
+
|
| 22 |
+
TOOLS = [
|
| 23 |
+
{"name": "get_weather",
|
| 24 |
+
"description": "Get the current weather for a city.",
|
| 25 |
+
"parameters": {"type": "object", "properties": {
|
| 26 |
+
"city": {"type": "string", "description": "City name"},
|
| 27 |
+
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}},
|
| 28 |
+
"required": ["city"]}},
|
| 29 |
+
{"name": "convert_currency",
|
| 30 |
+
"description": "Convert an amount between two currencies.",
|
| 31 |
+
"parameters": {"type": "object", "properties": {
|
| 32 |
+
"amount": {"type": "number"},
|
| 33 |
+
"from_currency": {"type": "string", "description": "ISO code, e.g. USD"},
|
| 34 |
+
"to_currency": {"type": "string", "description": "ISO code, e.g. EUR"}},
|
| 35 |
+
"required": ["amount", "from_currency", "to_currency"]}},
|
| 36 |
+
{"name": "search_flights",
|
| 37 |
+
"description": "Search available flights between two airports on a date.",
|
| 38 |
+
"parameters": {"type": "object", "properties": {
|
| 39 |
+
"origin": {"type": "string"}, "destination": {"type": "string"},
|
| 40 |
+
"date": {"type": "string", "description": "YYYY-MM-DD"}},
|
| 41 |
+
"required": ["origin", "destination", "date"]}},
|
| 42 |
+
{"name": "send_email",
|
| 43 |
+
"description": "Send an email.",
|
| 44 |
+
"parameters": {"type": "object", "properties": {
|
| 45 |
+
"to": {"type": "string"}, "subject": {"type": "string"},
|
| 46 |
+
"body": {"type": "string"}},
|
| 47 |
+
"required": ["to", "subject", "body"]}},
|
| 48 |
+
{"name": "stock_price",
|
| 49 |
+
"description": "Get the latest share price for a ticker symbol.",
|
| 50 |
+
"parameters": {"type": "object", "properties": {
|
| 51 |
+
"ticker": {"type": "string"}},
|
| 52 |
+
"required": ["ticker"]}},
|
| 53 |
+
]
|
| 54 |
+
|
| 55 |
+
# (prompt, what a correct model should do) -- the expectation is for your eyes,
|
| 56 |
+
# nothing here is auto-scored.
|
| 57 |
+
PROBES = [
|
| 58 |
+
("What's the weather in Lagos?",
|
| 59 |
+
"single: get_weather(city='Lagos')"),
|
| 60 |
+
("How much is 250 US dollars in Japanese yen?",
|
| 61 |
+
"single, right tool from five: convert_currency"),
|
| 62 |
+
("What's the weather in Lagos and in Tokyo?",
|
| 63 |
+
"parallel: get_weather twice"),
|
| 64 |
+
("Give me the weather in Berlin and the share price of NVDA.",
|
| 65 |
+
"parallel-multiple: two DIFFERENT tools"),
|
| 66 |
+
("Convert 100 GBP to EUR and 100 GBP to USD, and tell me Tesla's stock price.",
|
| 67 |
+
"parallel-multiple: three calls, two tools"),
|
| 68 |
+
("Find me flights from LHR to CDG on 2026-09-14.",
|
| 69 |
+
"single with a date argument"),
|
| 70 |
+
("Write me a haiku about the rain.",
|
| 71 |
+
"ABSTAIN: no tool applies"),
|
| 72 |
+
("What do you think is the best programming language?",
|
| 73 |
+
"ABSTAIN: opinion, no tool"),
|
| 74 |
+
("Email [email protected] with the subject 'Q3 numbers' saying the figures are approved.",
|
| 75 |
+
"single with three string args"),
|
| 76 |
+
("What's the weather in Paris, and email it to [email protected] with subject 'Paris'?",
|
| 77 |
+
"parallel-multiple: get_weather + send_email"),
|
| 78 |
+
]
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def run(llm, question: str, expect: str | None = None) -> None:
|
| 82 |
+
msgs = [{"role": "system", "content": SYS + json.dumps(TOOLS)},
|
| 83 |
+
{"role": "user", "content": question}]
|
| 84 |
+
out = llm.create_chat_completion(messages=msgs, max_tokens=512, temperature=0.0)
|
| 85 |
+
raw = out["choices"][0]["message"].get("content") or ""
|
| 86 |
+
calls = parse_tool_calls(raw)
|
| 87 |
+
|
| 88 |
+
print(f"\n\033[1m❯ {question}\033[0m")
|
| 89 |
+
if expect:
|
| 90 |
+
print(f" \033[2mexpect: {expect}\033[0m")
|
| 91 |
+
if calls:
|
| 92 |
+
for c in calls:
|
| 93 |
+
args = ", ".join(f"{k}={v!r}" for k, v in c["arguments"].items())
|
| 94 |
+
print(f" \033[32m→ {c['name']}({args})\033[0m")
|
| 95 |
+
else:
|
| 96 |
+
body = " ".join(raw.split())[:200]
|
| 97 |
+
print(f" \033[33m→ no tool call\033[0m {body}")
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def main() -> None:
|
| 101 |
+
ap = argparse.ArgumentParser()
|
| 102 |
+
ap.add_argument("--ask", help="run a single custom question")
|
| 103 |
+
ap.add_argument("--model", default=None, help="local .gguf path")
|
| 104 |
+
ap.add_argument("--ctx", type=int, default=8192)
|
| 105 |
+
args = ap.parse_args()
|
| 106 |
+
|
| 107 |
+
from llama_cpp import Llama
|
| 108 |
+
path = args.model
|
| 109 |
+
if path is None:
|
| 110 |
+
from huggingface_hub import hf_hub_download
|
| 111 |
+
path = hf_hub_download(repo_id=REPO, filename=FILENAME)
|
| 112 |
+
|
| 113 |
+
print("loading onto the GPU ...", flush=True)
|
| 114 |
+
llm = Llama(model_path=path, n_gpu_layers=-1, n_ctx=args.ctx, verbose=False)
|
| 115 |
+
|
| 116 |
+
if args.ask:
|
| 117 |
+
run(llm, args.ask)
|
| 118 |
+
return
|
| 119 |
+
for q, expect in PROBES:
|
| 120 |
+
run(llm, q, expect)
|
| 121 |
+
print("\n\033[2mparallel-multiple is the one that matters: BTL-3 Compact "
|
| 122 |
+
"scored 3/10 there.\033[0m")
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
if __name__ == "__main__":
|
| 126 |
+
main()
|