Instructions to use QuantFactory/Arch-Function-3B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/Arch-Function-3B-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/Arch-Function-3B-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/Arch-Function-3B-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/Arch-Function-3B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Arch-Function-3B-GGUF", filename="Arch-Function-3B.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/Arch-Function-3B-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Arch-Function-3B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Arch-Function-3B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Arch-Function-3B-GGUF: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 QuantFactory/Arch-Function-3B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Arch-Function-3B-GGUF: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 QuantFactory/Arch-Function-3B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/Arch-Function-3B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/Arch-Function-3B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Arch-Function-3B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/Arch-Function-3B-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "QuantFactory/Arch-Function-3B-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Arch-Function-3B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "QuantFactory/Arch-Function-3B-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Arch-Function-3B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use QuantFactory/Arch-Function-3B-GGUF with Ollama:
ollama run hf.co/QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/Arch-Function-3B-GGUF 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 QuantFactory/Arch-Function-3B-GGUF 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 QuantFactory/Arch-Function-3B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/Arch-Function-3B-GGUF to start chatting
- Pi new
How to use QuantFactory/Arch-Function-3B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
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": "QuantFactory/Arch-Function-3B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use QuantFactory/Arch-Function-3B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Arch-Function-3B-GGUF: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 QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use QuantFactory/Arch-Function-3B-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Arch-Function-3B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Arch-Function-3B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Arch-Function-3B-GGUF-Q4_K_M
List all available models
lemonade list
QuantFactory/Arch-Function-3B-GGUF
This is quantized version of katanemo/Arch-Function-3B created using llama.cpp
Original Model Card
katanemo/Arch-Function-3B
Overview
The Katanemo Arch-Function collection of large language models (LLMs) is a collection state-of-the-art (SOTA) LLMs specifically designed for function calling tasks. The models are designed to understand complex function signatures, identify required parameters, and produce accurate function call outputs based on natural language prompts. Achieving performance on par with GPT-4, these models set a new benchmark in the domain of function-oriented tasks, making them suitable for scenarios where automated API interaction and function execution is crucial.
In summary, the Katanemo Arch-Function collection demonstrates:
- State-of-the-art performance in function calling
- Accurate parameter identification and suggestion, even in ambiguous or incomplete inputs
- High generalization across multiple function calling use cases, from API interactions to automated backend tasks.
- Optimized low-latency, high-throughput performance, making it suitable for real-time, production environments.
Arch-Function is the core LLM used in then open source Arch Gateway to seamlessly integrate user prompts with developers APIs
Key Features
| Functionality | Definition |
| Single Function Calling | Call only one function per user query |
| Parallel Function Calling | Call the same function multiple times but with different set of parameter values |
| Multiple Function Calling | Call different functions per user query |
| Parallel & Multiple | Perform both parallel and multiple function calling |
Training Details
Katanemo Arch-Function collection is built on top of the Qwen 2.5. A blog with technical details leading to our models will be published soon.
Performance Benchmarks
We evaluate Katanemo Arch-Function series on the Berkeley Function-Calling Leaderboard (BFCL). We compare with commonly-used models and the results (as of Oct 21st, 2024) are shwon below. For each model family, we select the one with the highest rank.
| Rank | Model | Overall | Single Turn | Multi Turn | Hallucination | |||
| Non-live (AST) | Non-live (Exec) | Live (AST) | Overall | Relevance | Irrelevance | |||
| 1 | GPT-4o-2024-08-06 (FC) | 62.19% | 85.90% | 85.64% | 75.43% | 25.00% | 63.41% | 82.93% |
| Arch-Function-7B | 59.62% | 86.83% | 88.07% | 71.57% | 21.00% | 95.12% | 73.63% | |
| 6 | o1-preview-2024-09-12 (Prompt) | 59.27% | 86.42% | 88.88% | 73.08% | 17.62% | 73.17% | 74.60% |
| 9 | Gemini-1.5-Flash-002 (Prompt) | 57.92% | 86.58% | 89.48% | 76.28% | 9.88% | 85.37% | 78.54% |
| Arch-Function-3B | 57.69% | 85.19% | 86.18% | 71.21% | 17.50% | 90.24% | 72.88% | |
| 12 | Claude-3.5-Sonnet-20240620 (FC) | 57.42% | 70.04% | 66.27% | 74.68% | 28.38% | 68.29% | 74.58% |
| 13 | mistral-large-2407 (FC) | 56.80% | 86.62% | 84.57% | 68.37% | 20.62% | 75.61% | 49.44% |
| Arch-Function-1.5B | 56.20% | 84.40% | 83.96% | 69.36% | 15.88% | 87.80% | 74.39% | |
| 21 | Llama-3.1-70B-Instruct (Prompt) | 53.67% | 88.90% | 89.34% | 61.13% | 12.38% | 92.68% | 58.38% |
| 22 | Gemma-2-27b-it (Prompt) | 53.66% | 88.52% | 87.89% | 69.48% | 4.12% | 87.8% | 68.76% |
Requirements
The code of Arch-Function-3B has been in the Hugging Face transformers library and we advise you to install latest version:
pip install transformers>=4.37.0
How to use
We use the following example to illustrate how to use our model to perform function calling tasks. Please note that, our model works best with our provided prompt format. It allows us to extract JSON output that is similar to the function-calling mode of ChatGPT.
Single Turn Example
import json
from typing import Any, Dict, List
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "katanemo/Arch-Function-3B"
model = AutoModelForCausalLM.from_pretrained(
model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Please use our provided prompt for best performance
TASK_PROMPT = """
You are a helpful assistant.
""".strip()
TOOL_PROMPT = """
# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:
<tools>
{tool_text}
</tools>
""".strip()
FORMAT_PROMPT = """
For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
""".strip()
# Define available tools
get_weather_api = {
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "str",
"description": "The city and state, e.g. San Francisco, New York",
},
"unit": {
"type": "str",
"enum": ["celsius", "fahrenheit"],
"description": "The unit of temperature to return",
},
},
"required": ["location"],
},
},
}
openai_format_tools = [get_weather_api]
def convert_tools(tools: List[Dict[str, Any]]):
return "\n".join([json.dumps(tool) for tool in tools])
# Helper function to create the system prompt for our model
def format_prompt(tools: List[Dict[str, Any]]):
tool_text = convert_tools(tools)
return (
TASK_PROMPT
+ "\n\n"
+ TOOL_PROMPT.format(tool_text=tool_text)
+ "\n\n"
+ FORMAT_PROMPT
+ "\n"
)
system_prompt = format_prompt(openai_format_tools)
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "What is the weather in Seattle?"},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=512,
do_sample=False,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
response = tokenizer.decode(outputs[0][len(inputs[0]) :], skip_special_tokens=True)
print(response)
Then you should be able to see the following output string in JSON format:
<tool_call>
{"name": "get_weather", "arguments": {"location": "Seattle"}}
</tool_call>
Multi Turn Example
Upon getting results from functions, you can add it to the messages list as a user message and pass it to the model to get responses for users.
# Suppose we receive the following result from the function:
get_weather_api_result = {'name': 'get_weather', 'results': {'temperature': '62ยฐ', 'unit': 'fahrenheit'}}
execution_results = [get_weather_api_result]
def add_execution_results(messages: List[Dict[str, Any]], execution_results: List[Dict[str, Any]]):
content = "\n".join([f"<tool_response>\n{json.dumps(result)}</tool_response>" for result in execution_results])
messages.append({"role": "user", "content": content})
return messages
messages = add_execution_results(messages, execution_results)
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=512,
do_sample=False,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
response = tokenizer.decode(outputs[0][len(inputs[0]) :], skip_special_tokens=True)
print(response)
Then you should be able to see the following output:
The current temperature in Seattle is 62 degrees in Fahrenheit.
License
Katanemo Arch-Function collection is distributed under the Katanemo license.
- Downloads last month
- 820
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
docker model run hf.co/QuantFactory/Arch-Function-3B-GGUF: