98 7 months ago

ERNIE-4.5-21B Thinking Model - Ollama

tools
ollama run mua/ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL

Applications

Claude Code
Claude Code ollama launch claude --model mua/ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL
OpenClaw
OpenClaw ollama launch openclaw --model mua/ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL
Hermes Agent
Hermes Agent ollama launch hermes --model mua/ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL
Codex
Codex ollama launch codex --model mua/ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL
OpenCode
OpenCode ollama launch opencode --model mua/ERNIE-4.5-21B-A3B-Thinking-UD-Q2_K_XL

Models

View all →

Readme

English Introduction

Optimization Goal: Enable native function calling for the ERNIE-4.5-21B-A3B-Thinking model in Ollama environment, eliminating manual orchestration and improving inference efficiency.

Key Improvements:

  1. Tool Calling Protocol Adaptation - Adopts Qwen-style XML tag format (<tool_call> / <tool_response>), fully compatible with Ollama’s tool parsing mechanism, ensuring model outputs are correctly recognized as tool_calls structures.

  2. Enhanced Thinking Mode - Preserves ERNIE-4.5’s native <think></think> tags for reasoning process visualization. Frontend supports collapsible thinking blocks for better UX. Template supports both standard format (<think>content</think>) and streaming format (template pre-writes opening tag, model completes).

  3. Explicit Format Guidance - Embeds detailed tool calling examples and rules in system prompt:

    • Example 1: Demonstrates tool invocation after reasoning
    • Example 2: Demonstrates direct user response after reasoning
    • Explicitly prohibits custom tags like <response> to ensure output consistency
  4. Parameter Optimization - Fine-tuned for tool calling scenarios: temperature=0 ensures output stability, num_ctx=16384 supports long-context conversations, stop tokens precisely match <|im_start|> and <|im_end|> to prevent premature truncation.

Use Cases: LangChain/LangGraph agent development, RAG applications requiring tool calls, multimodal remote sensing image analysis systems, and any scenarios where models need to actively invoke external functions.


中文介绍

优化目标: 使 ERNIE-4.5-21B-A3B-Thinking 模型在 Ollama 环境下实现原生工具调用(Function Calling),避免手动编排,提升推理效率。

核心改进:

  1. 工具调用协议适配 - 采用 Qwen 风格的 XML 标签格式(<tool_call> / <tool_response>),完全兼容 Ollama 的工具解析机制,确保模型输出能被正确识别为 tool_calls 结构。

  2. 思考模式增强 - 保留 ERNIE-4.5 原生的 <think></think> 思考标签,支持模型进行推理过程展示。前端可折叠显示思考内容,提升用户体验。模板同时兼容标准格式(<think>内容</think>)和流式输出格式(模板预写开头,模型补全)。

  3. 明确格式指导 - 在系统提示中嵌入详细的工具调用示例和规则:

    • 示例 1:展示如何在思考后调用工具
    • 示例 2:展示如何在思考后直接回复用户
    • 明确禁止使用 <response> 等自创标签,确保输出格式统一
  4. 参数优化 - 针对工具调用场景调整参数:temperature=0 确保输出稳定性,num_ctx=16384 支持长上下文对话,停止标记精确匹配 <|im_start|><|im_end|>,避免过早截断。

适用场景: LangChain / LangGraph 智能体开发、需要工具调用的 RAG 应用、多模态遥感图像分析系统等需要模型主动调用外部函数的场景。