🚀 Arch-Agent-1.5B GGUF 模型
Arch-Agent-1.5B GGUF 模型是专为高级函数调用和基于代理的应用程序设计的最先进大语言模型集合,能出色处理复杂的多步骤任务,在复杂场景中表现卓越。
🚀 快速开始
环境要求
Arch-Agent-1.5B 的代码已集成在 Hugging Face 的 transformers
库中,建议安装最新版本:
pip install transformers>=4.51.0
使用示例
以下示例展示了如何使用该模型执行函数调用任务,请注意,该模型配合提供的提示格式使用效果最佳,它能提取类似于 OpenAI 函数调用 的 JSON 输出。
基础用法
import json
from typing import Any, Dict, List
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "katanemo/Arch-Agent-1.5B"
model = AutoModelForCausalLM.from_pretrained(
model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
TASK_PROMPT = (
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\n"
"You are provided with function signatures within <tools></tools> XML tags:\n<tools>\n{tool_text}"
"\n</tools>\n\nFor each function call, return a json object with function name and arguments within "
"""<tool_call></tool_call> XML tags:\n<tool_call>\n{{"name": <function-name>, """
""""arguments": <args-json-object>}}\n</tool_call>"""
)
tools = [
{
"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"],
},
},
}
]
def format_prompt(tools: List[Dict[str, Any]]):
tool_text = "\n".join(
[json.dumps(tool["function"], ensure_ascii=False) for tool in tools]
)
return TASK_PROMPT.format(tool_text=tool_text)
system_prompt = format_prompt(tools)
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "What is the weather in Seattle?"},
]
model_inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(model.device)
generated_ids = model.generate(**model_inputs, max_new_tokens=32768)
generated_ids = [
output_ids[len(input_ids) :]
for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
✨ 主要特性
- 多轮函数调用:在多个对话回合中保持上下文连续性,支持自然、持续的对话,可嵌套或动态使用工具。
- 多步函数调用:规划并执行一系列函数调用以完成复杂任务,能根据中间结果动态调整,将目标分解为子任务。
- 智能代理能力:具备高级决策和工作流管理能力,可处理复杂的代理任务,实现工具的无缝协调和错误恢复。
📚 详细文档
有关微调、推理和部署的更多详细信息,请参考 Github。
🔧 技术细节
模型生成
该模型使用 llama.cpp 在提交版本 0142961a
上生成。
性能基准
在 伯克利函数调用排行榜 (BFCL) 上对 Katanemo Arch-Agent 系列进行评估,与常用模型进行比较,截至 2025 年 6 月 14 日的结果如下:
⚠️ 重要提示
评估时,使用 YaRN 缩放技术部署模型进行多轮评估,所有 Arch-Agent 模型的上下文长度均为 64K。
📄 许可证
Arch-Agent 系列模型遵循 Katanemo 许可证 进行分发。
🔗 相关链接
💬 测试说明
测试内容
正在测试小型开源模型在 AI 网络监控方面的极限,具体包括:
- 针对实时网络服务的函数调用。
- 模型在处理以下任务时的最小规模:
- 自动化 Nmap 安全扫描。
- 量子就绪性检查。
- 网络监控任务。
测试模型
- TestLLM(当前实验模型,在 Hugging Face Docker 空间的 2 个 CPU 线程上运行 llama.cpp):
- ✅ 零配置设置。
- ⏳ 加载时间 30 秒(推理速度慢,但无 API 成本),由于成本低,无令牌限制。
- 🔧 寻求帮助!如果您对边缘设备 AI 感兴趣,欢迎合作!
- TurboLLM(使用 gpt-4.1-mini):
- 性能出色,但 OpenAI 按令牌收费,因此令牌使用受限。
- 可创建自定义命令处理器,在量子网络监控代理上运行 .net 代码。
- 实时网络诊断和监控。
- 安全审计。
- 渗透测试(Nmap/Metasploit)。
- HugLLM(最新开源模型):
- 🌐 在 Hugging Face 推理 API 上运行,使用 Novita 托管的最新模型,表现良好。
测试命令示例
"Give me info on my websites SSL certificate"
"Check if my server is using quantum safe encyption for communication"
"Run a comprehensive security audit on my server"
- '"Create a cmd processor to .. (what ever you want)" 注意,您需要安装 量子网络监控代理 才能运行 .net 代码,这是一个非常灵活且强大的功能,请谨慎使用!
最后说明
运行服务器、创建模型文件、运行量子网络监控服务以及支付 Novita 和 OpenAI 的推理费用均由个人承担。模型创建和量子网络监控项目的所有代码均为 开源,欢迎使用。
如果您认可这些工作,请考虑 请我喝杯咖啡 ☕,您的支持将有助于支付服务成本,并提高令牌使用限制。同时,也欢迎提供工作机会或赞助。
感谢您的支持! 😊