15 2 days ago

Context-optimized variant of IBM's Granite 4.2 3B model, tuned for lightweight tool-use on GPU-constrained hosts.

ollama run dna5rm/granite4.2:3b-8k

Models

View all →

1 model

granite4.2:3b-8k

2.2GB · 128K context window · Text · 2 days ago

Readme

dna5rm/granite4.2:3b-8k is a context-optimized derivative of granite4.2:3b that caps the default context window at 8,192 tokens. The base Granite 4.2 3B ships with a 128K context window. Loading at that default on a 12 GB GPU alongside other models causes VRAM pressure from KV cache. This variant sets a conservative 8K default so the model loads predictably without requiring clients to pass options.num_ctx on every request.

No weights are modified. The model retains the full 3.7B parameters (Q4_K_M quantization, 2.2 GB on disk) and all base model capabilities: completion, tool use, and thinking. The full IBM Granite chat template — including document-grounded RAG and function calling with XML-tagged tool call syntax — is preserved.

Same pattern as dna5rm/granite4.1:3b-8k.

Model Details

Property Value
Architecture granite
Parameters 3.7B
Quantization Q4_K_M
File Size 2.2 GB
Context Length (native) 131,072 tokens
Context Length (default) 8,192 tokens
Embedding Length 2,560
License Apache 2.0

Capabilities

  • Completion — standard text completion
  • Tools — function calling with XML-tagged <tool_call> syntax
  • Thinking — built-in <think>…</think> reasoning (Granite 4.2 new vs 4.1)

Template Features

The Granite chat template includes built-in support for:

  • Tool use — system message injection with tool schemas in <tools> XML tags; model responds with <tool_call> JSON blocks
  • Document-grounded RAG — documents passed via the document role are formatted into <documents> XML and the system prompt instructs the model to answer strictly from provided documents
  • Structured output — JSON output support for programmatic use
  • Thinkingenable_thinking / reasoning_effort; Ollama /set think and options.think

Parameters

{
  "num_ctx": 8192,
  "temperature": 1,
  "top_p": 0.95
}

Sampling matches upstream Granite 4.2 (temperature 1, top_p 0.95), not the 4.1 enterprise 0.7 default.

For lightweight tool-use, disable thinking per request (think: false or /set nothink) so tokens go to the tool call instead of a chain-of-thought.

Why This Variant Exists

The upstream granite4.2:3b defaults to 128K context. The 3B weights are small enough that full context will not overflow a 12 GB card by itself, but 128K still allocates a large KV cache that competes with other models.

On a 12 GB GPU (approx):

Context Weights KV Cache (approx) Total VRAM
8,192 ~2.2 GB ~0.4 GB ~2.6 GB
131,072 ~2.2 GB ~6.3 GB ~8.5 GB

The 8K default keeps the footprint minimal, leaving VRAM headroom for a larger primary model on the same GPU. Clients can still request larger contexts per-call via options.num_ctx.

Quick Start

# Pull
ollama pull dna5rm/granite4.2:3b-8k

# Run
ollama run dna5rm/granite4.2:3b-8k

# API — simple chat (thinking off)
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dna5rm/granite4.2:3b-8k",
    "messages": [{"role": "user", "content": "Write a Python function to check if a number is prime."}],
    "think": false
  }'

# API — tool use
curl http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dna5rm/granite4.2:3b-8k",
    "messages": [{"role": "user", "content": "What is the weather in Charlotte NC?"}],
    "think": false,
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather for a location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {"type": "string", "description": "City and state"}
          },
          "required": ["location"]
        }
      }
    }]
  }'

Native Ollama chat API: pass "think": false (or "options": {"think": false} depending on client).

Intended Use

Lightweight agentic and tool-use workloads where a fast, small model is preferred over a large one:

  • Tool calling / function routing — classification and dispatch to external tools
  • RAG — document-grounded Q&A with the built-in document template
  • Code assistance — Granite 4.2 is trained on a wide range of coding tasks, including FIM
  • Optional thinking — enable only when the extra latency is worth it
  • Multi-language — English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese

Supported Languages

English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, Chinese.

Base Model

Built from granite4.2:3b by IBM. Granite 4.2 is a dense decoder-only family with native multilingual, RAG, tool use, structured JSON, and thinking. Apache 2.0. See the upstream model card for training details.

Sibling variant: dna5rm/granite4.1:3b-8k (3.4B, no thinking capability).