Agents-A1-MTP-APEX-GGUF / README_zh.md
SC117's picture
Upload 2 files
e93eb5c verified
|
Raw
History Blame Contribute Delete
24.5 kB
metadata
library_name: transformers
license: apache-2.0
license_link: https://huggingface.co/InternScience/Agents-A1/blob/main/LICENSE
pipeline_tag: text-generation
tags:
  - qwen3_5_moe
  - qwen3_5
  - reasoning
  - agentic
  - mtp
  - apex
  - quantization
  - gguf
  - multimodal
base_model:
  - InternScience/Agents-A1
APEX MTP Vision Apache-2.0

Agents-A1-MTP-APEX

English | 📖 中文文档

35B Agentic MoE 达到万亿参数性能 · APEX 量化 GGUF + BF16 + mmproj

🤖 关于 Agents-A1

Agents-A1InternScience 提出的 35B 参数 Mixture-of-Experts Agentic 模型,在 Qwen3.5-35B-A3B 的基础上通过三阶段范式后训练得到:全域 SFT → 域级教师训练 → 多教师多域 on-policy 蒸馏。

尽管参数规模只有 ~35B,Agents-A1 在与 GPT-5.5、DeepSeek-V4-pro、Kimi-K2.6 等前沿大模型的对比中依然表现强劲——在 Seal-0 (56.4)、HiPhO (46.4)、FrontierScience-Olympiad (79.0)、IFBench (80.6)、IFEval (94.8) 达到 SOTA,同时在 BrowseComp (75.5)、XBench-DS-2510 (86.0)、GAIA (96.0)、SciCode (44.3)、HLE (47.6)、MolBench-bind (56.8) 等任务上于同尺寸模型中排名第一。

本 GGUF 包包含 mmproj-F16.gguf 视觉投影器(支持 llama.cpp 多模态)。MTP 层从 Qwen3.5-35B-A3B 中提取并注入到 Agents-A1 的 safetensors(详见 MTP 提取与注入 章节)。许可证:Apache-2.0。

🧠 模型详情
架构Qwen3.5 MoE(Mixture of Experts)
参数规模35B 总参数,每 token 激活 3B
专家数256 个路由专家,每 token 激活 8 个
层数40 层 Transformer + 1 层 MTP
上下文262,144 tokens
MTP 来源Qwen3.5-35B-A3B(1 层,785 个 tensor,注入)
Block Count41(blk.0–39 + blk.40 MTP)
许可证Apache-2.0
🔧 MTP 提取与注入

官方发布的 InternScience/Agents-A1 checkpoint 是一个 40 层 Qwen3.5-35B-A3B MoE,不包含 MTP(Multi-Token Prediction)层。为了在 llama.cpp 中启用 MTP 加速(长上下文生成提速 10–30%),我们 从 Qwen3.5-35B-A3B 中提取 1 层 MTP,注入到 Agents-A1 的 safetensors 中,再转 GGUF。

步骤 1 — 从 Qwen3.5-35B-A3B 提取 MTP tensor

源:J:\Models\Qwen3.5-35B-A3B-MTP(Qwen3.5-35B-A3B + 原生 MTP)
from safetensors import safe_open
import json, os
·
src = r"J:\Models\Qwen3.5-35B-A3B-MTP"
with open(os.path.join(src, "model.safetensors.index.json")) as f:
    idx = json.load(f)
mtp_keys = [k for k in idx["weight_map"] if "mtp" in k.lower()]
print(f"Found {len(mtp_keys)} MTP tensors")  # 785

步骤 2 — 作为新分片(N+1)追加

把 785 个 MTP tensor 保存为新分片
new_shard = "model.safetensors-15-of-15.safetensors"
save_file({k: get_tensor(k) for k in mtp_keys}, new_shard)
·
更新 model.safetensors.index.json:
  · metadata.total_size += 新分片大小
  · weight_map: 为每个 MTP key 追加新分片路径
  · 不修改原 14 个分片(避免触碰原始数据)

步骤 3 — 用 master llama.cpp 转 BF16 GGUF

F:\llama.cpp\llama.cpp-master\convert_hf_to_gguf.py ^
  J:\Models\Agents-A1 ^
  --outfile J:\Models\Agents-A1-MTP-GGUF\Agents-A1-MTP-BF16.gguf ^
  --outtype f16
·
master 版本自动处理 Qwen3.5MoE + MTP:
  · 常规层:blk.0–39
  · MTP 层:blk.40.nextn.*  (785 个 tensor)

步骤 4 — 用 APEX 量化(Q4_K_M 默认,MTP 用 Q8_0)

F:\llama.cpp\...\llama-quantize.exe ^
  --imatrix J:\Models\Qwen3.5-35B-A3B.imatrix.gguf ^
  --tensor-type-file E:\apex-quant\configs\qwen36_35b_mtp_<档位>.txt ^
  J:\Models\Agents-A1-MTP-GGUF\Agents-A1-MTP-BF16.gguf ^
  J:\Models\Agents-A1-MTP-GGUF\Agents-A1-MTP-APEX-I-<档位>.gguf ^
  Q4_K_M
·
APEX qwen36_35b_mtp_*.txt 配置已包含 blk.40 override
(所有档位 MTP 用 Q8_0)—— 无需手动 patch。
📊 BenchLocal 测试结果(APEX-I-Compact, 16.14 GB)
模式ToolCall-15BugFind-15HermesAgent-20能力上限实用得分
思考100888791.271.2
无思考971008593.157.1

测试环境:RTX 5070 Ti 16GB + 128GB RAM · 无思考模式能力上限更高(BugFind +12),但复杂 agent 场景重试更多。

🚀 使用方法

llama.cpp(纯文本)

hf download SC117/Agents-A1-MTP-APEX-GGUF --include "*.gguf" --local-dir ./models
./llama-server -m ./models/Agents-A1-MTP-APEX-I-Compact.gguf -ngl 99 -c 131072

llama.cpp(视觉 + 文本)

./llama-server -m ./models/Agents-A1-MTP-APEX-I-Compact.gguf --mmproj ./models/mmproj-F16.gguf -ngl 99 -c 131072

vLLM

vllm serve SC117/Agents-A1-MTP-APEX-GGUF --port 8000 --tensor-parallel-size 1 --max-model-len 262144 --reasoning-parser qwen3
·
工具调用变体
vllm serve SC117/Agents-A1-MTP-APEX-GGUF --port 8000 --tensor-parallel-size 1 --max-model-len 262144 --reasoning-parser qwen3 --enable-auto-tool-choice --tool-call-parser qwen3_coder

SGLang

python3 -m sglang.launch_server --model-path "SC117/Agents-A1-MTP-APEX-GGUF" --host 0.0.0.0 --port 30000
🎛️ 推荐采样参数

摘自 官方 Agents-A1 模型卡

temperature0.85
top_p0.95
top_k20
min_p0.0
presence_penalty1.1
repetition_penalty1.0
💡 什么是 APEX?

本仓库的 GGUF 文件使用 APEX 量化——一种 MoE 感知的混合精度量化技术。APEX 对每个 tensor 按角色分类(路由专家、共享专家、SSM、注意力),按层级应用精度梯度:边缘敏感层(含 MTP)更高精度,中间冗余层更激进压缩。

APEX 在文件大小减半的前提下,PPL 仍优于 Q8_0,在部分场景甚至优于 F16。

qwen36_35b_mtp_*.txt 配置已包含 blk.40(MTP 层)的 override,所有四个 I 档位均以 Q8_0 保留。imatrix Qwen3.5-35B-A3B.imatrix.gguf 直接复用(同架构、专家布局兼容)。

📦 APEX 量化档位
文件大小档位适用场景
*-APEX-I-Quality.gguf21.75 GBI-Quality高质量(Q6_K + iq4_xs 注意力)
*-APEX-I-Balanced.gguf24.21 GBI-Balanced全能型(Q6_K + Q5_K 专家)
*-APEX-I-Compact.gguf16.14 GBI-Compact质量/体积最佳平衡(Q4_K 默认)
*-APEX-I-Mini.gguf13.36 GBI-Mini极致压缩,适配 16GB 显存(Q3_K + iq2_s)

BF16 源文件:Agents-A1-MTP-BF16.gguf(66.19 GB)。imatrix:Qwen3.5-35B-A3B.imatrix.gguf(从基座模型复用)。

相关链接

引用

@misc{bai2026scalinghorizonparametersreaching,
      title={Scaling the Horizon, Not the Parameters: Reaching Trillion-Parameter Performance with a 35B Agent},
      author={Lei Bai and Zongsheng Cao and Yang Chen and Zhiyao Cui and Shangheng Du and Yue Fan and Shiyang Feng and Zijie Guo and Haonan He and Liang He and Xiaohan He and Shuyue Hu and Yusong Hu and Songtao Huang and Yichen Jiang and Hao Li and Xin Li and Dahua Lin and Weihao Lin and Fenghua Ling and Dongrui Liu and Zhuo Liu and Runmin Ma and Chunjiang Mu and others},
      year={2026},
      eprint={2606.30616},
      archivePrefix={arXiv}
}