๐ Llama-xLAM-2-8b-fc-r GGUF Models
These GGUF models are designed to enhance decision - making by translating user intentions into executable actions. They are particularly useful for multi - turn conversations and function - calling tasks, offering state - of - the - art performance in relevant benchmarks.
๐ Quick Start
The new xLAM models are fully compatible with vLLM and Transformers - based inference frameworks. You can start using them following the basic usage examples provided in the "Usage" section.
โจ Features
- Function Calling: The
-fc
suffix indicates that the models are fine - tuned for function - calling tasks.
- Research Release: The
-r
suffix signifies a research release.
- High Performance: Achieve state - of - the - art performance on BFCL and ฯ - bench benchmarks, outperforming frontier models like GPT - 4o and Claude 3.5.
- Multi - turn Conversation: Well - suited for multi - turn conversations, making interactions more natural and efficient.
๐ฆ Installation
Framework versions
- Transformers 4.46.1 (or later)
- PyTorch 2.5.1+cu124 (or later)
- Datasets 3.1.0 (or later)
- Tokenizers 0.20.3 (or later)
๐ป Usage Examples
Basic Usage with Huggingface Chat Template
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("Salesforce/Llama-xLAM-2-3b-fc-r")
model = AutoModelForCausalLM.from_pretrained("Salesforce/Llama-xLAM-2-3b-fc-r", torch_dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "user", "content": "Hi, how are you?"},
{"role": "assistant", "content": "Thanks. I am doing well. How can I help you?"},
{"role": "user", "content": "What's the weather like in London?"},
]
tools = [
{
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"], "description": "The unit of temperature to return"}
},
"required": ["location"]
}
}
]
print("====== prompt after applying chat template ======")
print(tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, tokenize=False))
inputs = tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, return_dict=True, return_tensors="pt")
input_ids_len = inputs["input_ids"].shape[-1]
inputs = {k: v.to(model.device) for k, v in inputs.items()}
print("====== model response ======")
outputs = model.generate(**inputs, max_new_tokens=256)
generated_tokens = outputs[:, input_ids_len:]
print(tokenizer.decode(generated_tokens[0], skip_special_tokens=True))
Using vLLM for Inference
Setup and Serving
- Install vLLM with the required version:
pip install "vllm>=0.6.5"
- Download the tool parser plugin to your local path:
wget https://huggingface.co/Salesforce/xLAM-2-1b-fc-r/raw/main/xlam_tool_call_parser.py
- Start the OpenAI API - compatible endpoint:
vllm serve Salesforce/xLAM-2-1b-fc-r \
--enable-auto-tool-choice \
--tool-parser-plugin ./xlam_tool_call_parser.py \
--tool-call-parser xlam \
--tensor-parallel-size 1
Testing with OpenAI API
import openai
import json
client = openai.OpenAI(
base_url="http://localhost:8000/v1",
api_key="empty"
)
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "The unit of temperature to return"
}
},
"required": ["location"]
}
}
}
]
response = client.chat.completions.create(
model="Salesforce/xLAM-2-1b-fc-r",
messages=[
{"role": "system", "content": "You are a helpful assistant that can use tools."},
{"role": "user", "content": "What's the weather like in San Francisco?"}
],
tools=tools,
tool_choice="auto"
)
print("Assistant's response:")
print(json.dumps(response.model_dump(), indent=2))
๐ Documentation
Model Generation Details
This model was generated using llama.cpp at commit 6adc3c3e
.
Quantization Beyond the IMatrix
I've been experimenting with a new quantization approach that selectively elevates the precision of key layers beyond what the default IMatrix configuration provides. In my testing, standard IMatrix quantization underperforms at lower bit depths, especially with Mixture of Experts (MoE) models. To address this, I'm using the --tensor - type
option in llama.cpp
to manually "bump" important layers to higher precision. You can see the implementation here:
๐ [Layer bumping with llama.cpp](https://github.com/Mungert69/GGUFModelBuilder/blob/main/model - converter/tensor_list_builder.py)
While this does increase model file size, it significantly improves precision for a given quantization level.
Model Series
Model |
# Total Params |
Context Length |
Category |
Download Model |
Download GGUF files |
Llama - xLAM - 2 - 70b - fc - r |
70B |
128k |
Multi - turn Conversation, Function - calling |
[๐ค Link](https://huggingface.co/Salesforce/Llama - xLAM - 2 - 70b - fc - r) |
NA |
Llama - xLAM - 2 - 8b - fc - r |
8B |
128k |
Multi - turn Conversation, Function - calling |
[๐ค Link](https://huggingface.co/Salesforce/Llama - xLAM - 2 - 8b - fc - r) |
[๐ค Link](https://huggingface.co/Salesforce/Llama - xLAM - 2 - 8b - fc - r - gguf) |
xLAM - 2 - 32b - fc - r |
32B |
32k (max 128k)* |
Multi - turn Conversation, Function - calling |
[๐ค Link](https://huggingface.co/Salesforce/xLAM - 2 - 32b - fc - r) |
NA |
xLAM - 2 - 3b - fc - r |
3B |
32k (max 128k)* |
Multi - turn Conversation, Function - calling |
[๐ค Link](https://huggingface.co/Salesforce/xLAM - 2 - 3b - fc - r) |
[๐ค Link](https://huggingface.co/Salesforce/xLAM - 2 - 3b - fc - r - gguf) |
xLAM - 2 - 1b - fc - r |
1B |
32k (max 128k)* |
Multi - turn Conversation, Function - calling |
[๐ค Link](https://huggingface.co/Salesforce/xLAM - 2 - 1b - fc - r) |
[๐ค Link](https://huggingface.co/Salesforce/xLAM - 2 - 1b - fc - r - gguf) |
*Note: The default context length for Qwen - 2.5 - based models is 32k, but you can use techniques like YaRN (Yet Another Recursive Network) to achieve maximum 128k context length. Please refer to [here](https://huggingface.co/Qwen/Qwen2.5 - 32B - Instruct#processing - long - texts) for more details.
You can also explore our previous xLAM series [here](https://huggingface.co/collections/Salesforce/xlam - models - 65f00e2a0a63bbcd1c2dade4).
Benchmark Results
Berkeley Function - Calling Leaderboard (BFCL v3)
Performance comparison of different models on [BFCL leaderboard](https://gorilla.cs.berkeley.edu/leaderboard.html). The rank is based on the overall accuracy, which is a weighted average of different evaluation categories. "FC" stands for function - calling mode in contrast to using a customized "prompt" to extract the function calls.
ฯ - bench Benchmark
Success Rate (pass@1) on ฯ - bench benchmark averaged across at least 5 trials. Our xLAM - 2 - 70b - fc - r model achieves an overall success rate of 56.2% on ฯ - bench, significantly outperforming the base Llama 3.1 70B Instruct model (38.2%) and other open - source models like DeepSeek v3 (40.6%). Notably, our best model even outperforms proprietary models such as GPT - 4o (52.9%) and approaches the performance of more recent models like Claude 3.5 Sonnet (new) (60.1%).
Pass^k curves measuring the probability that all 5 independent trials succeed for a given task, averaged across all tasks for ฯ - retail (left) and ฯ - airline (right) domains. Higher values indicate better consistency of the models.
Ethical Considerations
This release is for research purposes only in support of an academic paper. Our models, datasets, and code are not specifically designed or evaluated for all downstream purposes. We strongly recommend users evaluate and address potential concerns related to accuracy, safety, and fairness before deploying this model. We encourage users to consider the common limitations of AI, comply with applicable laws, and leverage best practices when selecting use cases, particularly for high - risk scenarios where errors or misuse could significantly impact people's lives, rights, or safety. For further guidance on use cases, refer to our AUP and AI AUP.
Model Licenses
For all Llama relevant models, please also follow corresponding Llama license and terms. Meta Llama 3 is licensed under the Meta Llama 3 Community License, Copyright ยฉ Meta Platforms, Inc. All Rights Reserved.
If you find these models useful
Help me test my AI - Powered Quantum Network Monitor Assistant with quantum - ready security checks:
๐ Quantum Network Monitor
The full Open Source Code for the Quantum Network Monitor Service available at my github repos ( repos with NetworkMonitor in the name) : Source Code Quantum Network Monitor. You will also find the code I use to quantize the models if you want to do it yourself GGUFModelBuilder
๐ฌ How to test:
Choose an AI assistant type:
TurboLLM
(GPT - 4.1 - mini)
HugLLM
(Hugginface Open - source models)
TestLLM
(Experimental CPU - only)
What Iโm Testing
Iโm pushing the limits of small open - source models for AI network monitoring, specifically:
- Function calling against live network services
- How small can a model go while still handling:
- Automated Nmap security scans
- Quantum - readiness checks
- Network Monitoring tasks
๐ก TestLLM โ Current experimental model (llama.cpp on 2 CPU threads on huggingface docker space):
- โ
Zero - configuration setup
- โณ 30s load time (slow inference but no API costs). No token limited as the cost is low.
- ๐ง Help wanted! If youโre into edge - device AI, letโs collaborate!
Other Assistants
๐ข TurboLLM โ Uses gpt - 4.1 - mini :
- **It performs very well but unfortunately OpenAI charges per token. For this reason tokens usage is limited.
- Create custom cmd processors to run .net code on Quantum Network Monitor Agents
- Real - time network diagnostics and monitoring
- Security Audits
- Penetration testing (Nmap/Metasploit)
๐ต HugLLM โ Latest Open - source models:
- ๐ Runs on Hugging Face Inference API. Performs pretty well using the latest models hosted on Novita.
๐ก Example commands you could test:
"Give me info on my websites SSL certificate"
"Check if my server is using quantum safe encryption for communication"
"Run a comprehensive security audit on my server"
- '"Create a cmd processor to .. (what ever you want)" Note you need to install a Quantum Network Monitor Agent to run the .net code on. This is a very flexible and powerful feature. Use with caution!
Final Word
I fund the servers used to create these model files, run the Quantum Network Monitor service, and pay for inference from Novita and OpenAIโall out of my own pocket. All the code behind the model creation and the Quantum Network Monitor project is open source. Feel free to use whatever you find helpful.
If you appreciate the work, please consider buying me a coffee โ. Your support helps cover service costs and allows me to raise token limits for everyone.
I'm also open to job opportunities or sponsorship.
Thank you! ๐
๐ง Technical Details
Quantization
The new quantization approach selectively elevates the precision of key layers beyond the default IMatrix configuration. Although it increases the model file size, it significantly improves the precision for a given quantization level. The implementation can be found at [Layer bumping with llama.cpp](https://github.com/Mungert69/GGUFModelBuilder/blob/main/model - converter/tensor_list_builder.py).
๐ License
This model is licensed under cc - by - nc - 4.0. For all Llama relevant models, please also follow corresponding Llama license and terms. Meta Llama 3 is licensed under the Meta Llama 3 Community License, Copyright ยฉ Meta Platforms, Inc. All Rights Reserved.
โ ๏ธ Important Note
This release is for research purposes only in support of an academic paper. Our models, datasets, and code are not specifically designed or evaluated for all downstream purposes. We strongly recommend users evaluate and address potential concerns related to accuracy, safety, and fairness before deploying this model.
๐ก Usage Tip
When using the models, make sure to follow the recommended framework versions. For vLLM inference, use vllm>=0.6.5
to avoid degraded performance for Qwen - based models.