llama.cpp 部署 Qwen3-14B-Claude-4.5-Opus-High-Reasoning-Distill-GGUF
模型: Qwen3-14B-Claude-4.5-Opus-High-Reasoning-Distill-GGUF
显存: 21~25GB
max-model-len: 40960
: 4
使用 Ollama 和 llama.cpp 两种方法部署 Qwen3-14B-Claude-4.5-Opus-High-Reasoning-Distill-GGUF 模型的流程。内容包括环境准备、模型下载、配置文件修改、编译构建及启动参数说明。重点讲解了显存需求、上下文长度设置、思考模式控制及工具调用功能,并提供了服务停止与管理建议。
模型: Qwen3-14B-Claude-4.5-Opus-High-Reasoning-Distill-GGUF
显存: 21~25GB
max-model-len: 40960
: 4
部署服务器: DGX-Spark-GB10 120GB
生成速率: 13 tokens/s
| 对比项 | Ollama | llama.cpp | LM Studio/OpenWebUI |
|---|---|---|---|
| 上手难度 | ⭐ 最简单 | ⭐⭐⭐ 需编译 | ⭐ 图形界面 |
| 推理性能 | 🔶 中等 | 🥇 最强 | 🔶 中等 |
| GPU 控制 | 有限 | 完全可控 | 有限 |
| API 服务 | 开箱即用 | 需手动启动 | 内置 |
| 适合场景 | 快速部署/生产 | 性能调优/研究 | 本地体验 |
前提:已经安装了 ollama。
从 Huggingface 或 ModelScope 下载模型文件。
使用 Qwen3-14B-Claude-4.5-Opus-Distill.q8_0.gguf 模型。
FROM ./Qwen3-14B-Claude-4.5-Opus-Distill.q8_0.gguf TEMPLATE """{{ if .System }}<|im_start|>system {{ .System }}<|im_end|> {{ end }}{{ if .Prompt }}<|im_start|>user {{ .Prompt }}<|im_end|> {{ end }}<|im_start|>assistant {{ .Response }}<|im_end|>""" PARAMETER temperature 0.6 PARAMETER top_p 0.95 PARAMETER repeat_penalty 1.0
ollama create qwen3-claude-distill -f Modelfile
注意:模型的思考模板有些问题,需要修改。
Ollama API 默认端口是 11434,请求示例:
curl http://localhost:11434/api/chat \
-H "Content-Type: application/json" \
-d '{ "model": "qwen3-claude-distill", "messages": [ {"role": "user", "content": "你好,介绍一下你自己"} ], "stream": false }'
git clone https://github.com/ggerganov/llama.cpp
cd ./llama.cpp cmake -B build \
-DGGML_CUDA=ON \
-DLLAMA_BUILD_SERVER=ON \
-DCMAKE_BUILD_TYPE=Release cmake --build build --config Release -j 8
# 结果将存于 ./build/bin/。如果构建失败可直接删除 build 目录即可 rm -rf build
# 参数说明:
# -DLLAMA_BUILD_SERVER=ON 强制构建 llama-server
# -DGGML_CUDA=ON 启用 GPU
# Release 性能更好
# 验证安装成功
./build/bin/llama-server --help
简化命令:
./build/bin/llama-server \
-m /path/to/models/Qwen3-14B-Claude-4.5-Opus-Distill.q8_0.gguf \
-ngl 999 \
-c 40960 \
--host 0.0.0.0 \
--port 8908
后台运行部署
nohup ./build/bin/llama-server \
-m /path/to/models/Qwen3-14B-Claude-4.5-Opus-Distill.q8_0.gguf \
-ngl 999 \
--batch-size 1024 \
--threads 16 \
--parallel 4 \
--jinja \
--reasoning-format deepseek \
--reasoning-budget -1 \
-c 40960 \
--host 0.0.0.0 \
--port 8908 \
>> /path/to/logs/llama_Qwen3-14B_Distill.log 2>&1 &
# 查看日志
tail -f ~/models/logs/llama_Qwen3-14B_Distill.log
参数说明:
--n-gpu-layers:指定有多少 transformer 层放到 GPU 上执行
0 全部 CPU
20 前 20 层 GPU
999 尽可能全部 GPU
-c 40960:即--ctx-size,上下文长度(最大 token 数)
--host 0.0.0.0:是否可远程访问,使用此参数可以局域网访问
--port 8908:HTTP 监听端口
--threads 16:CPU 线程数量
--batch-size 1024:GPU 每一步最多算多少 token
--parallel 4:允许同时处理多少个请求(并发会话数)
--reasoning-format deepseek:思考模板
--reasoning-budget N:思考模式控制
值 含义
-1 不限制思考(默认,开启)
0 禁用思考模式
>0 限制思考 token 数量(部分模型支持)
重要提醒(关于 40K) Qwen3-14B q8_0:
对话端点
http://localhost:8908/v1/chat/completions
http://<服务器 IP>:8908/v1/chat/completions
默认开启思考模式
curl http://<服务器 IP>:8908/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{ "model": "Qwen3-14B", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "介绍一下新加坡"} ], "temperature": 0.7, "max_tokens": 500 }'
关闭思考模式
curl http://<服务器 IP>:8908/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{ "model": "Qwen3-14B", "messages": [ {"role": "system", "content": "你是一个只回答用户问题的助手"}, {"role": "user", "content": "你好"} ], "temperature": 0.7, "max_tokens": 200, "chat_template_kwargs": { "enable_thinking": false } }'
工具的调用
curl http://<服务器 IP>:8908/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{ "model": "Qwen3-14B", "messages": [ {"role": "system", "content": "你是一个只回答用户问题的助手"}, {"role": "user", "content": "新加坡现在几点?"} ], "temperature": 0.7, "max_tokens": 200, "tools": [ {"type": "function", "function": {"name": "get_current_time", "description": "获取指定城市的当前时间", "parameters": {"type": "object", "properties": {"city": {"type": "string", "description": "城市名称"}}, "required": ["city"]}}}], "tool_choice": "auto", "chat_template_kwargs": { "enable_thinking": false } }'
假设你这样启动:
nohup ./build/bin/llama-server ... > llama.log 2>&1 &
1 查看进程 ps aux | grep llama-server # 显示 PID
2 杀掉进程 kill -9 <PID>
pkill llama-server
⚠️ 会杀掉所有 llama-server 进程。
如果你知道端口是 8908:
lsof -i:8908
kill <进程号>
管理服务,而不是 nohup。
| nohup | systemd |
|---|---|
| 手动管理 | 自动重启 |
| 无状态管理 | 可开机启动 |
| 无健康检测 | 有状态监控 |

微信公众号「极客日志」,在微信中扫描左侧二维码关注。展示文案:极客日志 zeeklog
使用加密算法(如AES、TripleDES、Rabbit或RC4)加密和解密文本明文。 在线工具,加密/解密文本在线工具,online
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online
将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML 转 Markdown 互为补充。 在线工具,Markdown 转 HTML在线工具,online