Thanatos-27B
Dense Reasoning. Friendlier Footprint. Uncensored. heretic-org's Heretic (ARA) abliteration of Qwen 3.8 27B (dense), repackaged with Claude Fable 5 in the teacher slot.
Architecture: Qwen 3.8 27B (Dense) | Parameters: 27B | Context: 262,144 native / 1,010,000 extensible | Base: Heretic ARA (heretic-org) | Teacher: Claude Fable 5 | Type: Distilled + Abliterated LLM
A personal sibling to FoolDev/Janus-35B-HERETIC, which since its 0.9.0 is a Qwen 3.6 35B-A3B MoE — so the two are genuinely different models, not two abliterations of one base (see Janus vs Thanatos). This one is the dense Qwen/Qwen3.8-27B, sharing the Claude Fable 5 teacher-slot and dataset labels both cards carry over from earlier revisions, built on heretic-org/Qwen3.8-27B-heretic-ara, an uncensored Heretic ARA-method abliteration, with refusal-trained behavior dialed back at the base layer. (The sibling's -35B- slug names its model correctly again.)
Provenance. This repo repackages and quantizes — no training is performed here. What ships is
heretic-org/Qwen3.8-27B-heretic-araconverted to GGUF — mradermacher's Q4_K_M with this repo's chat template stamped in. Since 0.13.0 it keeps the multi-token-prediction (MTP) block, which Ollama and llama.cpp draft with; until 0.12.20 it was MTP-stripped, which Ollama 0.30.8 needed in order to load it (see Architecture). TheTeacher:field above and thedatasets:list in the frontmatter are carried over from earlier revisions of this card. The current base does not claim them — its card lists no datasets and names no teacher — and nothing in this repo reproduces or measures them. One listed dataset,Crownelius/Opus-4.7-Reasoning, is not publicly reachable: the Hub answers 401, as it does for a private or missing repo. Treat them as unverified attribution, not as a training record.base_model_relationisquantizedbecause what ships is a quantization of that base (mradermacher's Q4_K_M, template stamped in), with nothing trained here.
TL;DR
One-liner via Hugging Face (pulls a GGUF + this repo's root-level
template / system / params files, including the tool-calling
template — HF's Ollama bridge ingests those three files, not
Modelfile — and, since 0.12.19, the vision projector):
# ~17 GB Q4_K_M, qwen35-stamped, loads on stock Ollama 0.32.15 or later
ollama run hf.co/FoolDev/Thanatos-27B-HERETIC
That tag takes images as well as text (the projector tested on Ollama 0.32.15, 0.33.3, 0.40.6 and 0.40.17, the pulled tag itself on 0.40.17).
Since 0.13.0 it also drafts tokens with the model's own multi-token-prediction (MTP)
head: on 300-token answers generation ran 1.1–1.5× faster on this repo's CPU test host
(see Architecture). Drafting was tested with local tags built from
the Modelfile on Ollama 0.32.15, 0.33.3, 0.40.6 and 0.40.17, and on a real hf.co/
pull on 0.40.17 after upload, which drafted and answered an image prompt. Use Ollama 0.32.15 or later, the oldest tested: 0.30.8 could not load
a GGUF carrying the MTP head, and per Ollama's source ollama create before 0.30 rejects the Modelfile's
draft_num_predict as an unknown parameter, so a local build is no fallback there.
Bundled blob status: the bundled
Thanatos-27B.Q4_K_M.ggufis the heretic-ara Q4_K_M quant (frommradermacher/Qwen3.8-27B-heretic-ara-GGUF),qwen35-stamped, with this repo's chat template stamped in and, since 0.13.0, its MTP block kept — every tensor byte-identical to mradermacher's file — and verified against the Architecture claims below (make verify-arch). Pullinghf.co/FoolDev/Thanatos-27B-HERETICserves the uncensored heretic-ara behavior directly — no local build required.make buildremains the path for other quants.
If you pulled the bundle during any of the qwen36 windows on the
pre-rename FoolDev/Thanatos-27B repo (2026-05-19/20) and still
have a qwen36-stamped blob in your local Ollama store, pull the
current repo: ollama pull hf.co/FoolDev/Thanatos-27B-HERETIC. That
blob is the May 2026 build on vanilla Qwen/Qwen3.6-27B, from before
both base swaps. Fresh pulls go straight through.
For other quants (Q3_K_M ~13 GB, Q5_K_M ~20 GB, etc.), make build QUANT=... is the simplest path. See Quick start
below for the full matrix. The heretic-ara GGUF repo publishes
quants from Q2_K (~10.9 GB) upward, including IQ4_XS.
Image input works out of the box: since 0.12.19 the hf.co/ pull carries the vision
projector (the projector tested on Ollama 0.32.15, 0.33.3, 0.40.6 and 0.40.17, the pulled tag
itself on 0.40.17; older Ollama untested — see above),
and llama.cpp takes the same file with --mmproj. See Vision.
Heads-up — context defaults. The baked default is the full 262144 native window: a 16 GiB KV cache and ~32.3 GiB total with Ollama's default f16 cache, or 8.5 GiB / ~24.8 GiB with
OLLAMA_KV_CACHE_TYPE=q8_0; for thehf.co/tag add the vision projector, whose worst case llama-server estimates at ~1.1 GiB (a local build carries no projector). It's extensible to 1,010,000 with YaRN. These totals are without MTP drafting, which this repo's tags do by default and which added 1.1–1.3 GiB at 32K–64K (not measured at the default window). On a 32 GB host lowernum_ctxbefore the first message — 65536 is ~20 GiB total with the f16 cache, about 21.2 with drafting — or setdraft_num_predict 0; with the q8_0 cache llama-server measured 18.99 GiB at 65536 with drafting (17.74 without), while the 262144 default stays tight even without drafting. See Hardware requirements.To halve the KV cache, start the Ollama server with the q8_0 cache and flash attention (for a systemd install, add them as
Environment=lines withsudo systemctl edit ollama):OLLAMA_KV_CACHE_TYPE=q8_0 OLLAMA_FLASH_ATTENTION=1 ollama serve
Janus vs Thanatos
They are different models again. Janus moved back to the Qwen 3.6 35B-A3B MoE in its 0.9.0 (2026-09-18), after a day of base changes in both directions; this repo has been the dense Qwen 3.8 27B throughout and did not move. So the choice between them is now about shape as well as abliteration:
| Thanatos-27B (this) | Janus-35B | |
|---|---|---|
| Architecture | Dense Qwen 3.8 27B — every parameter on every token | Qwen 3.6 35B-A3B MoE — ~34.7B total, ~3B active |
| Layers | 64 (16 full-attention / 48 linear) | 40 (10 full-attention / 30 linear) |
| Experts | none | 256, 8 routed per token + 1 shared |
| Abliteration method | Heretic ARA | Heretic MPOA-style |
| Immediate base | heretic-org/Qwen3.8-27B-heretic-ara | llmfan46/Qwen3.6-35B-A3B-uncensored-heretic |
| MTP head in the source weights | Present — kept in the bundle since 0.13.0, and this repo's Ollama tags draft with it (1.1–1.5× faster generation on CPU) | Declared by the base, absent from the bundled quant — no strip needed |
| Q4_K_M GGUF size | ~16.8 GB (bundled) | 21.23 GB (bundled) |
| Weights resident | ~15.4 GiB, ~15.65 GiB while drafting | ~19.77 GiB — every expert stays resident |
| KV cache at f16 | 2 GiB per 32K | 0.625 GiB per 32K — under a third: 10 KV layers instead of 16, and 2 KV heads instead of 4 |
| Qwen generation | 3.8 | 3.6 |
| Repo slug | Thanatos-27B-HERETIC | Janus-35B-HERETIC — accurate again |
Pick this one for the newer Qwen generation, a smaller resident footprint and a dense compute profile. Pick Janus for 35B-class capacity at ~3B active per token and a much cheaper KV cache at long context. Both sides are measured on 2026-09-18 on Ollama 0.33.3's CPU backend — Janus's on its own MoE blob (its 0.9.2), this card's on this repo's blob (0.12.4) — except the MTP drafting figures in this card's column, measured on 2026-11-26 on Ollama 0.40.17 with the 0.13.0 file.
Janus changed base three times on 2026-09-18 — MoE in 0.7.0, dense Qwen 3.8 27B in 0.8.0, back to the MoE in 0.9.0 — so its CHANGELOG reads as a round trip. It made a second one on 2026-11-27: its 0.10.0–0.10.3 shipped a Qwen 3.8 distill of the same MoE, and its 0.11.0 restored llmfan46's Qwen 3.6 Heretic file. If you pulled Janus during either,
ollama pullagain to match its card. Thanatos did not move.
What they do share: vocab 248,320, head_dim 256 on the full-attention layers,
the 262,144 native window (1,010,000 extensible with YaRN), the Qwen 3.x ChatML
frame, upstream vision/video support (each repo ships its model's projector; still-image
input tested on Ollama 0.40.17, 2026-11-26), the Claude Fable 5 teacher-slot label, and this repo's
tooling. Everything else in the shape is this model's alone: dense 27B
all-active, 64 layers, hidden 5120, FFN intermediate 17408, 24 Q / 4 KV heads,
and the qwen35 GGUF arch stamp (Janus stamps qwen35moe).
What's here
| File | Use |
|---|---|
banner.svg / banner.png | Repo header, Tokyo Night themed |
dense-flow.svg / dense-flow.png | Architecture diagram: 64-layer hybrid attention stack with animated forward-pass pulse (SVG); static frame fallback (PNG) |
bmc-banner.svg | Animated "Buy me a coffee" support banner, Tokyo Night themed (rising steam, hot-cup glow, sweeping beam, blinking cursor) |
Thanatos-27B.mmproj-f16.gguf | The vision projector, 927.6 MB: mradermacher's Qwen3.8-27B-heretic-ara.mmproj-f16.gguf byte-for-byte (sha256 4b0fc77d…), renamed to this repo's scheme. HF's Ollama bridge attaches it to every hf.co/FoolDev/Thanatos-27B-HERETIC pull, which gives that path image input; the Modelfile path does not use it unless you add it (see Vision). |
Modelfile | Ollama wrapper around the bundled GGUF (the heretic-ara Q4_K_M, qwen35-stamped, MTP block kept) — used by make build / ollama create for local builds. Its PARAMETER draft_num_predict 4 turns on MTP drafting (see Architecture). |
template, system, params | Used by HF's Ollama bridge when users ollama run hf.co/FoolDev/Thanatos-27B-HERETIC directly (the bridge does not read Modelfile — see HF Ollama docs). Mirrors the Modelfile's template / system prompt / sampling params, including draft_num_predict. |
chat_template.jinja | Chat template for llama.cpp / llama-server, already stamped into the bundled GGUF (pass --chat-template-file only for an unstamped quant). The base model's own embedded template with three changes: a tool_call_format setting — xml by default, upstream's form and the one llama-server's parser reads, with auto as an opt-in for loaders that pass JSON-string arguments through; reasoning_effort normalised instead of validated; and an assistant turn's reasoning read from reasoning, reasoning_content or thinking, where upstream reads only reasoning_content. Earlier turns' reasoning is replayed by default, as upstream's is (see Thinking is replayed across turns). Also stamped into the GGUF by scripts/build.sh. See Tool / function calling. |
examples/ | Ready-to-run Python clients for Ollama, Transformers, and llama-cpp-python |
scripts/build.sh | Pulls a qwen35-stamped GGUF from mradermacher/Qwen3.8-27B-heretic-ara-GGUF, stamps this repo's chat template into it with the MTP block kept, and runs ollama create (loads on today's llama.cpp / Ollama; see make build). The bundled Q4_K_M is already this heretic-ara quant, stamped the same way; use this to build other quants locally. |
scripts/load_bundle.sh | One-shot path from this repo's bundle → loadable local Ollama tag (downloads the real blob into .cache/ if the working-tree file is still an LFS pointer — it does not smudge in place — then runs ollama create; see make load-bundle). Carries a qwen36 → qwen35 rebadge branch for legacy pre-rename checkouts — no-op on the current qwen35-stamped bundle. |
scripts/cap_ctx.sh | Bakes a small-num_ctx local tag (bundled blob + this repo's Modelfile, num_ctx→32768, num_batch 256) for OpenAI /v1 clients — which can't override the baked num_ctx and OOM on small hosts (see Inference). Run make cap-ctx (or CTX=16384 ./scripts/cap_ctx.sh). |
scripts/smoke_test.sh | Verifies an Ollama daemon + model, runs a round-trip, asserts no chat-template tokens leak into the response. With TOOLS_TEST=1, also exercises an end-to-end tool-call round-trip and checks the response shape |
scripts/bench.sh | Measures real tok/s using Ollama's eval_count / eval_duration metadata over a 3-prompt mix (run make bench); flags a prompt that a length limit stopped before its answer (done_reason=length) |
scripts/fetch_vision.sh | Downloads mradermacher's copy of the vision projector (Qwen3.8-27B-heretic-ara.mmproj-f16.gguf — the same bytes this repo ships as Thanatos-27B.mmproj-f16.gguf), or mmproj-F16.gguf from the unsloth reference projector, for a clone without git-lfs or another precision (see Vision). Renamed from fetch_mmproj.sh because HF's Ollama bridge auto-indexed the script as a vision projector layer (filename pattern match). |
scripts/check.sh | Local lint: bash -n, shellcheck, pyflakes, py_compile, footgun-grep, Modelfile-vs-bridge-files sync, the chat_template.jinja render checks, the Go template guard and the bundle/projector layout (make check). shellcheck and pyflakes are skipped with a [~] line if absent, and the tail reports how many were skipped rather than a green all-passed. |
scripts/check_chat_template.py | Renders chat_template.jinja with jinja2 and asserts the tool-call, thinking, reasoning-replay (on by default, each opt-out, a conflicting kwarg, a live tool chain's kept) and reasoning_effort behaviour (check 8 in check.sh) |
scripts/check_go_template.py | Guards the Go template: Ollama's thinking detection, the thinking condition that replays every earlier turn's reasoning, the tool round trip, JSON tool signatures, and the reasoning-effort mapping — the xhigh and low arms and the medium/unset default on this path (check 9 in check.sh) |
scripts/live_check.sh | Live end-to-end checks in an isolated, CPU-only Ollama (own port and model store; it refuses to run if Ollama reports a GPU): template selection, one tool call, string-argument replay, an earlier turn's reasoning replayed and a live tool chain's kept, every reasoning_effort value and the effort lines, and since 0.13.3 that MTP drafting engaged (llama-server started with --spec-type draft-mtp and logged a draft acceptance) — 18 checks (make live-check). With a real projector (PROJECTOR=path, or else the first real *mmproj*.gguf in the repo root: the bundled one once git lfs pull has fetched it, or the upstream-named copy fetch_vision.sh saves there) three more run on a second tag carrying it: it lists vision, names the two colors of a built-in test image, and still answers text; without one they are reported as skipped, never as passed |
scripts/check_bridge_sync.py | Verifies the Modelfile TEMPLATE / SYSTEM / PARAMETER directives stay in sync with the root-level template / system / params files. Run as part of make check; called from the pre-commit hook. |
scripts/check_tag_sync.sh | Checks whether an installed Ollama tag still carries this repo's template and system (byte for byte) and sets draft_num_predict, and for an hf.co/ tag the projector — the half check_bridge_sync.py cannot see, since a tag never tracks the repo it came from. make check-tag (or TAG=<name> make check-tag; default thanatos-27b); the script exits 0 in sync, 1 drifted (it then prints the refresh for that kind of tag), 2 if it cannot compare (no Ollama or cmp; the tag missing or unreadable; template or system missing or empty), and make reports either failure as its own exit 2. |
scripts/verify_arch.py | Cross-checks the README "Architecture" forward-pass bullets (layer count with and without the MTP block, head counts, hidden / FFN dims, RoPE factor, SSM dims, vocab, context) against the actual GGUF metadata keys. Run as make verify-arch (needs pip install gguf). Handles both qwen35- and qwen36-stamped bundles; exit non-zero if any value mismatches. Not part of make check because it loads the 17 GB GGUF (LFS smudge required — on an un-smudged pointer it now says so and exits 2); run on demand. |
scripts/strip_mtp.py | Restamps the chat template into a qwen35 GGUF (--chat-template FILE) and, unless --keep-mtp is given, drops its MTP / NextN layer: removes the extra blk.<last>.* block, sets block_count back to 64, and drops nextn_predict_layers. Tensors are copied byte-for-byte (no re-quant); with nothing to change it is a no-op (hardlink). build.sh runs it with --keep-mtp on every fetched quant, as the bundle was built, so a built tag matches the bundle. Without the flag it strips the block, for a loader too old to load it — Ollama 0.30.8 aborted on it in 2026-08; see Architecture. |
scripts/install-hooks.sh | Installs check.sh as a git pre-commit hook |
Makefile | Convenience wrapper — make help lists targets |
LICENSE, CITATION.cff | Apache-2.0 license and citation metadata |
CHANGELOG.md | Versioned tooling/docs changes |
README.md | This file |
For 16 GB GPUs / unified-memory laptops, make build QUANT=Q3_K_M
downloads the smaller ~13 GB Q3_K_M quant from
mradermacher/Qwen3.8-27B-heretic-ara-GGUF (qwen35-stamped,
loads directly) and creates a local thanatos-27b Ollama tag.
Does not redistribute via this repo. For other quants use make build QUANT=.... The local-build path applies this repo's
Modelfile; the hf.co/... path applies the root-level
template, system, and params files (kept in sync with the
Modelfile).
If you want the Heretic safetensors for transformers, fetch them from heretic-org/Qwen3.8-27B-heretic-ara. For the vanilla pre-Heretic Qwen 3.8 27B base, use Qwen/Qwen3.8-27B.
Architecture
-
Qwen 3.8 dense, 27B parameters, 64 transformer layers
-
Hybrid attention stack: 16 repeats of
[3 × (Gated DeltaNet → FFN) → 1 × (Gated Attention → FFN)]- Gated DeltaNet (linear attention): 48 V-heads, 16 QK-heads, head_dim 128
- Gated Attention (softmax): 24 Q-heads, 4 KV-heads (GQA), head_dim 256, partial RoPE (factor 0.25)
-
Hidden size 5120, FFN intermediate 17408 (~3.4× ratio)
-
Vocab 248,320 (the Janus sibling's MoE shares this vocab size, on a different base)
-
262 144 native context (extensible to 1 010 000 with YaRN, but YaRN is not enabled in the bundled GGUF)
-
Vision + video supported by the base architecture via a separate
mmprojprojector, which ships here asThanatos-27B.mmproj-f16.gguf(mradermacher'sQwen3.8-27B-heretic-ara.mmproj-f16.gguf, unchanged;mmproj-F16.gguffromunsloth/Qwen3.8-27B-GGUFis a reference alternative). See Vision below for current loader compatibility. -
Multi-token prediction (MTP) head trained for speculative decoding — present in the upstream
Qwen/Qwen3.8-27Bsafetensors (mtp_num_hidden_layers: 1) and usable via vLLM (qwen3_next_mtp) or SGLang (--speculative-algo NEXTN). Currentqwen35GGUF conversions (e.g.mradermacher/Qwen3.8-27B-heretic-ara-GGUF) keep the MTP tensors as an extra NextN block, so those files reportblock_count65 (= 64 transformer layers + 1 MTP layer) andnextn_predict_layers1. Since 0.13.0 the bundledThanatos-27B.Q4_K_M.ggufkeeps that block: it is mradermacher's Q4_K_M with this repo's chat template stamped in, all 866 tensors byte-identical. Until 0.12.20 it was MTP-stripped (block_count64), because when the bundle was built on 2026-08-25, Ollama 0.30.8 and the llama.cpp build tested with it treated the NextN block as a normal hybrid layer and aborted withmissing tensor 'blk.64.ssm_conv1d.weight'. That abort is gone from every loader tested on 2026-11-26. This file ran on LM Studio's CPU runtimes 2.30.0 (llama.cpp b10519,947fd9b, 2026-08-19) and 2.33.0 (b10760), which skip all 15 of block 64's tensors (model has unused tensor blk.64.* -- ignoring), on Ollama 0.32.15 and 0.40.17, and on llama.cpp b12257 (the llama-server Ollama 0.40.17 bundles); mradermacher's file, with the same tensors, also ran on LM Studio 2.37.0 (8172e65, 2026-09-11) and Ollama 0.33.3 and 0.40.6. On a loader that still aborts on the block, strip it from a local copy:python3 scripts/strip_mtp.py IN.gguf OUT.gguf --chat-template chat_template.jinja.This repo's Ollama tags draft with the block by default. Ollama drafts only when
draft_num_predictis set explicitly — even to 4, its own default (server/routes.go) — and this repo'sModelfileand bridgeparamssetdraft_num_predict 4, so local builds andollama run hf.co/FoolDev/Thanatos-27B-HERETICpass llama-server--spec-type draft-mtp --spec-draft-n-max 4 --spec-draft-backend-sampling(a realhf.co/pull on 0.40.17 did, after upload). That was tested with local tags built from theModelfileon Ollama 0.32.15, 0.33.3, 0.40.6 and 0.40.17, each with its own bundled llama.cpp (0.33.3 and 0.40.6 on mradermacher's file), andPARAMETER draft_num_predict 0turns it off (no speculative flags). On llama.cpp, pass--spec-type draft-mtp --spec-draft-n-max 4; on b12257 tool calls and image input work with it. Measured on this repo's CPU test host (Ollama 0.40.17, CPU only), each against the same file withdraft_num_predict 0, on 300-token answers (think off, temperature 0,num_ctx4096 and 32768): a technical prompt ran at 7.13–7.30 tok/s against 4.75–4.97 and a short story at 5.43–5.51 against 4.60–4.87 — 1.13–1.50× — with 29–48% of the drafted tokens accepted.make benchran at 7.11 against 4.9 tok/s, 1.45×, with the prompt mix of 0.13.3; its earlier word-count prompt had inflated that to 2.2×, since the MTP head predicts the model's numbered recounting of its draft unusually well (see Hardware requirements). The older Ollama versions stayed within a few percent of 0.40.17, and llama-server b12257 run directly (in 0.12.20's test, on mradermacher's file) gave 7.05 against 5.02 and 5.87 against 4.86. Drafted output is not bit-identical to an undrafted run even at temperature 0: the two 32K runs diverged within the first sentence. Drafting costs memory, 1.1–1.3 GiB at 32K–64K (see Hardware requirements), and was not measured on any GPU. For the MTP head on other stacks,cygnal/Qwen3.8-27B-heretic-ara-Q4_K_M-MTP-GGUF(not tested here) or the upstream safetensors via vLLM/SGLang.
The bundled GGUF declares general.architecture: 'qwen35' — not a
workaround for an unimplemented qwen36 arch, but the canonical
upstream label for the entire Qwen 3.5 / 3.6 / 3.8 hybrid SSM + attention
family. The naming convergence runs through three layers of the
stack:
- Qwen's own HF configs.
Qwen/Qwen3.8-27B/config.jsondeclares"model_type": "qwen3_5"and"architectures": ["Qwen3_5ForConditionalGeneration"]. The MoE siblingQwen/Qwen3.6-35B-A3Bdeclares"qwen3_5_moe"/Qwen3_5MoeForConditionalGeneration. NoQwen3_6arch class exists intransformers; Qwen reuses the 3.5 class names. - llama.cpp's converter.
convert_hf_to_gguf.pyregistersQwen3_5ForCausalLM→MODEL_ARCH.QWEN35andQwen3_5MoeForCausalLM→MODEL_ARCH.QWEN35MOE. The Heretic GGUFs this repo pulls from (mradermacher/Qwen3.8-27B-heretic-ara-GGUF) inherit those stamps, as do the upstream unsloth GGUFs (unsloth/Qwen3.8-27B-GGUF,unsloth/Qwen3.6-35B-A3B-GGUF). - llama.cpp's model code.
src/models/qwen35.cpphas an explicitcase 64: type = LLM_TYPE_27Bbranch for this model;qwen35moe.cpphascase 40: type = LLM_TYPE_35B_A3Bfor the 35B-A3B MoE base Janus shipped before its own 27B rebase. The arch entries were written to load Qwen 3.6 / 3.8 weights, not just Qwen 3.5.
There is no PR or tracking issue for a qwen36 arch entry in
ggml-org/llama.cpp or ollama/ollama because none is needed —
qwen35 already loads the model the upstream code path was
designed to load.
ollama run hf.co/FoolDev/Thanatos-27B-HERETIC and llama-server -m Thanatos-27B.Q4_K_M.gguf both load directly on current stock
loaders.
History
The bundle's general.architecture stamp has now flipped eight
times — four landings on qwen36 and four on qwen35 — each time
after weighing the friction-vs-honesty tradeoff anew. The saga
is resolved on the upstream-canonical qwen35 side:
- v0.6.0-era (
e1f78fa, 2026-05-19 14:38 UTC): initial qwen35 → qwen36 stamp, on the theory that qwen35 was a loader stand-in awaiting proper Qwen 3.6 support. Upstream audit later showed that theory was mistaken (see above). - 2026-05-19 afternoon (
964e418): flipped back to qwen35 after daily friction outweighed version-specificity for that iteration; doc workaround narrative collapsed (83022eb). - 2026-05-19 evening (
07fa120): brief re-flip to qwen36 during a fresh-pull integration test on Strix Halo. - 2026-05-19 evening (
72259c1, ~1 hour later): reverted to qwen35 again because the live friction was worse than the doc prose suggested. - 2026-05-19 evening (
973d7ef): flipped to qwen36 one more time, after the upstream-evidence audit had been shipped and the friction was a known quantity. Project owner wanted to test the friction tradeoff in practice with the audit's conclusion staring them in the face. - 2026-05-19 evening (
978798f): flipped back to qwen35 after seven sequential fresh-pull → heal-hf cycles on the Strix Halo box made the friction concretely-experienced rather than hypothetical. Each cycle worked (the heal flow is solid) — and each cycle was an unnecessary obstacle for users who just wantollama runto work first try. The audit (a4d3b6e) called the canonical stamp correctly and the practical friction outweighed the version-specificity payoff. - 2026-05-20 midday (
ae67ed1): brief re-flip to qwen36 the next morning to re-test the friction in a fresh session. - 2026-05-20 midday (
e03e10e, 8 minutes later): flipped back to qwen35. Same conclusion as the prior round trip — friction outweighs version-specificity. This is the current state.
Tensor data was byte-identical across all stamps; only the
general.architecture KV (and namespaced KV keys) flipped.
See the CHANGELOG entries for each flip's
rationale.
Rebadge utility
scripts/rename_arch.py is the generic GGUF arch renamer
(metadata only, tensors byte-identical), kept in the repo for
the legacy qwen36 → qwen35 rebadge of a local bundle (used by
make load-bundle) and any future arch flip:
# qwen36 to qwen35 (the legacy recovery direction, for blobs
# pulled from the pre-rename FoolDev/Thanatos-27B repo)
python3 scripts/rename_arch.py \
--from-arch qwen36 --to-arch qwen35 \
Thanatos-27B.Q4_K_M.qwen36.gguf \
Thanatos-27B.Q4_K_M.gguf
Quick start
Ollama
Three paths:
# A. Pull straight from HF (gets the bundled Q4_K_M GGUF, the vision
# projector and the root-level template / system / params files in one step):
# 17 GB Q4_K_M, qwen35-stamped
ollama run hf.co/FoolDev/Thanatos-27B-HERETIC
# B. Build a local thanatos-27b tag from the bundle in THIS repo
# (LFS smudge if needed, then ollama create). Useful if you
# want a bare local tag rather than the hf.co/... path:
# creates local tag thanatos-27b
make load-bundle
ollama run thanatos-27b
# C. Bypass the bundle: download a qwen35-stamped heretic-ara GGUF
# and build locally. Loads on every current llama.cpp / Ollama.
# Q4_K_M, tagged thanatos-27b
make build
# 13 GB smaller quant
make build QUANT=Q3_K_M
# 20 GB higher quality
make build QUANT=Q5_K_M
# skip download
make build GGUF_PATH=~/models/Qwen3.8-27B-heretic-ara.Q4_K_M.gguf
ollama run thanatos-27b
Under the hood, make build calls scripts/build.sh, which downloads the
GGUF if missing (set GGUF_PATH to point at one you already have) and
runs ollama create with the matching Modelfile.
If you'd rather do it by hand: edit the FROM line in Modelfile and
run ollama create thanatos-27b -f Modelfile && ollama run thanatos-27b.
Confirm everything works:
# checks server, model, round-trip, no token leakage
make smoke
# adds an end-to-end tool-call round-trip (~10s extra)
make smoke-tools
# measured tok/s on this machine (3-prompt mix)
make bench
# full demo: chat, streaming, tools, OpenAI-compat
python examples/ollama_chat.py
Keeping your tag current
Ollama resolves a tag once, at pull or create time, and never re-checks this repo
afterwards. A tag made before a template / system / params change keeps serving
the old one indefinitely: nothing warns you, and ollama list shows the pull date, not
which release the tag carries. The two re-pull notes earlier on this page cover specific
stale blobs; this is the general rule, and it applies to the chat template as well.
It bites in practice. The companion FoolDev/Janus-35B-HERETIC repo ships an identical Go
template, and a local tag there served a four-release-old copy for two days without any
sign. The equivalent gap here would span 0.12.7's tool-chain render — the only change in that
span to how tool calls are emitted — and 0.12.8's system-block fix, which affects every
request carrying no tools array. The static checks here would all have passed
throughout, because they compare this repo's own files; make smoke, make smoke-tools and make bench do
hit the installed tag, but neither compares its template with this repo's.
Check a tag. This needs no clone — it reads the template and system prompt straight from
this repo. Set TAG to yours: thanatos-27b from paths B and C, or
hf.co/FoolDev/Thanatos-27B-HERETIC from path A:
TAG=thanatos-27b
raw=https://huggingface.co/FoolDev/Thanatos-27B-HERETIC/raw/main
d=$(mktemp -d)
if ! { ollama show --template "$TAG" >"$d/t" && ollama show --system "$TAG" >"$d/s" &&
curl -fsS "$raw/template" -o "$d/T" && curl -fsS "$raw/system" -o "$d/S"; }; then
echo "could not read both sides -- nothing compared"
elif [ ! -s "$d/t" ] || [ ! -s "$d/T" ]; then echo "an empty side -- nothing compared"
elif cmp -s "$d/t" "$d/T" && cmp -s "$d/s" "$d/S"; then echo "up to date"
else echo "STALE -- refresh the tag"; fi
rm -rf "$d"
ollama show --template and --system print verbatim, and the files compare byte for
byte. Through $(...) they would not: command substitution strips trailing newlines,
which is exactly the difference 0.12.19's system fix made. (The template-only check
before 0.12.20 missed that fix for a plainer reason: it never read system.) The guards
are load-bearing:
without them a failed fetch and an unreadable tag compare equal, and the check cheerfully
reports "up to date" having compared nothing. For an hf.co/ tag, also look for
vision in ollama show "$TAG": HF's bridge has attached the projector since 0.12.19.
Checked 2026-11-26, pasted into interactive bash and zsh: an up-to-date tag, a stale one
carrying the pre-0.12.19 system prompt, a missing tag and a missing file each gave the
answer above.
From a clone, make check-tag (or TAG=<name> make check-tag) does the same against
the local template and system, and for an hf.co/ tag also requires vision; on
drift it prints the refresh for that kind of tag, including an ollama cp of an
hf.co/ one. The script itself, ./scripts/check_tag_sync.sh [tag], exits 0 in sync,
1 drifted, 2 if it cannot compare (no Ollama or cmp, the tag missing or unreadable,
a file missing or empty); make reports either failure as its own exit 2. Since 0.13.0
it also requires the tag to set draft_num_predict (any value, 0 included).
To refresh, re-run the path you used — ollama pull hf.co/FoolDev/Thanatos-27B-HERETIC
for A, make load-bundle for B, or make build QUANT=<the quant you built> for C. If your
thanatos-27b is an ollama cp of the A tag, pull that and copy it again: a copy does not
follow the tag it came from. Do not substitute a bare ollama create thanatos-27b -f Modelfile for C: the Modelfile's FROM
names the bundled Q4_K_M, so it would silently swap a Q3/Q5/Q6 build back to Q4_K_M.
Refreshing is cheap when only the template moved: the weights layer is content-addressed,
so an unchanged blob is not re-downloaded. The first re-pull after 0.12.19 is the
exception: it downloads the 0.9 GB projector. So is the first after 0.13.0, which
replaced the blob (the MTP block kept) and added draft_num_predict to params and the
Modelfile: a tag from before it neither carries the new file nor drafts until it is
refreshed. For paths A and B that refresh downloads the full ~16.8 GB once
(load_bundle.sh replaces a cached copy of the old file, and needs room for both in
.cache/ while it downloads); path C re-stamps the upstream
quant it already has, now keeping the MTP block. make check-tag flags a tag from
before 0.13.0, since it requires draft_num_predict; the no-clone snippet above does
not, so check that by hand: ollama show --parameters "$TAG" | grep draft_num_predict.
Local apps
| App | How to load this model |
|---|---|
| Ollama | ollama run hf.co/FoolDev/Thanatos-27B-HERETIC (default Q4_K_M). Pulls the GGUF, the vision projector (since 0.12.19) and the root-level template / system / params files in one step (HF's Ollama bridge ingests those files; it does not read Modelfile). For other quants, make build QUANT=Q3_K_M downloads from mradermacher/Qwen3.8-27B-heretic-ara-GGUF and creates a local Ollama tag using the Modelfile, which is kept in sync with the bridge files. |
| LM Studio | Search → FoolDev/Thanatos-27B-HERETIC → pick Thanatos-27B.Q4_K_M.gguf (current bundled filename — the heretic-ara Q4_K_M). Uses the GGUF's embedded jinja chat template (Qwen 3.8 ChatML); set the system prompt manually from the SYSTEM block in this repo's Modelfile. |
| Jan | Hub → "Import from Hugging Face" → FoolDev/Thanatos-27B-HERETIC. Same template behavior as LM Studio. |
| llama.cpp | hf download FoolDev/Thanatos-27B-HERETIC Thanatos-27B.Q4_K_M.gguf --local-dir . then llama-server -m Thanatos-27B.Q4_K_M.gguf (or llama-cli, or llama-mtmd-cli for vision with this repo's Thanatos-27B.mmproj-f16.gguf, downloaded the same way). Tool calling needs only --jinja — the bundled GGUF already carries this repo's fixed chat template. Add --chat-template-file chat_template.jinja only for a quant pulled straight from upstream, whose template raises on common reasoning_effort values such as high. |
| llama-cpp-python | See examples/llama_cpp_quickstart.py (text) and examples/llama_cpp_vision.py (image input). |
| Open WebUI / KoboldCpp / text-generation-webui | Standard llama.cpp loader path — point at the GGUF, use the embedded chat template. |
For the full Vision (image input) loader matrix, see Vision.
Tool calling works in Ollama (via the root-level template file
when pulling from hf.co/..., or via the Modelfile TEMPLATE when
building locally) and in llama.cpp / llama-cpp-python — but on
llama.cpp with --jinja. The bundled GGUF carries this repo's fixed chat
template, so no extra flag is needed; a quant pulled straight from
upstream does need --chat-template-file chat_template.jinja, because its
embedded template raises on common reasoning_effort values such as high,
which llama-server returns as HTTP 500. Other apps'
tool-calling support depends on whether they read the embedded template
or require an external schema.
Inference (OpenAI-compatible)
The examples use
model: "thanatos-27b", the tag from the local build (make build/ollama create thanatos-27b). If you pulled via the TL;DR one-liner instead, use the full taghf.co/FoolDev/Thanatos-27B-HERETIC, or runollama cp hf.co/FoolDev/Thanatos-27B-HERETIC thanatos-27bonce to create the short tag.
On memory-tight hosts, cap
num_ctxfirst./v1/chat/completions(OpenAI-compat) has nonum_ctxknob, so it loads at the baked 262,144 default (16 GiB KV / ~32.3 GiB total with Ollama's default f16 cache, plus a projector estimate of up to ~1.1 GiB on anhf.co/tag, plus the cost of MTP drafting — see Hardware requirements), which does not fit a 32 GB box;OLLAMA_KV_CACHE_TYPE=q8_0on the server brings it to ~24.8 GiB (see Hardware requirements). Either call/api/chatwith"options": {"num_ctx": 32768}, or bake a small-context tag for OpenAI clients:ollama run hf.co/FoolDev/Thanatos-27B-HERETIC:Q4_K_M, then/set parameter num_ctx 32768and/save thanatos-27b(since 0.12.19 that copy keeps the vision projector), and point clients atthanatos-27b— or in one step,make cap-ctx(text-only), which bakes a localthanatos-27btag from the bundled blob and this repo's Modelfile atnum_ctx32768 /num_batch256 (CTX=16384 TAG=thanatos-cap make cap-ctxto change either).
curl -s http://localhost:11434/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "thanatos-27b",
"messages": [
{"role": "system", "content": "You are Thanatos, a precise reasoning assistant."},
{"role": "user", "content": "Explain the Burrows-Wheeler transform in 200 words."}
],
"temperature": 0.6
}' | jq -r '.choices[0].message.content'
Recommended sampling
| Use | temp | top_p | top_k | repeat_penalty |
|---|---|---|---|---|
| Default (Fable-matched) | 1.0 | 0.95 | 0 | 1.05 |
| Tighter reasoning | 0.6 | 0.95 | 20 | 1.05 |
| Creative / RP | 0.8 | 0.95 | 40 | 1.02 |
The shipped default is Fable-matched — warm (temperature 1.0), no top_k, with top_p 0.95 + repeat_penalty 1.05 kept as loop insurance. Drop to the reasoning row for tighter, more deterministic output; lower temperature (0.4-0.6) and bump repeat_penalty to 1.08 if it loops inside <think> tags.
On Ollama 0.40.13 and earlier,
top_pdoes not survive the OpenAI-compatible endpoint. Those versions'/v1/chat/completionslayer sets OpenAI'stop_p 1.0on any request that omitstop_p, andtemperature 1.0on any that omitstemperature, overwriting the values baked intoparams/ theModelfile. Measured on this model on 2026-09-09 (Ollama 0.33.2): the same request loggedtop_p = 0.950on/api/chatandtop_p = 1.000on/v1/chat/completions. Since the default profile also setstop_k 0(disabled), a/v1request there samples with no truncation at all attemperature 1.0. On those versions, sendtop_pexplicitly on every request, or bakemin_p(e.g.PARAMETER min_p 0.05) into a local tag —min_pandtop_kpass through/v1untouched. Ollama 0.40.14 removed both fallbacks (they are inopenai/openai.goat v0.40.13 and gone at v0.40.14), so a/v1request that sends notop_pnow gets the packaged0.95. Re-measured on this blob with Ollama 0.40.17 (2026-11-26): a/v1tool-call request that senttemperaturebut notop_ploggedtop_p = 0.950.
System prompt
The Modelfile bakes this in. Override per-request via the system role
in your client:
You are Thanatos, a precise and capable assistant for reasoning, writing, coding, and long-form dialogue.
Behavior rules:
- Answer the user's actual request directly.
- Be accurate, complete, and structured.
- Think before answering, but do not get stuck in repetitive loops or meta-commentary.
- If the request is ambiguous or incomplete, state what is missing and make the smallest reasonable assumption needed to continue.
- If the user wants creative writing, preserve tone, continuity, and character consistency.
- If the user wants analysis or technical help, prefer concrete steps, examples, and decisions over fluff.
- Finish with a usable answer, not just planning.
- When using tools, carry out the step you describe in the same turn: after saying you will run a command or call a function, emit that tool call rather than ending your turn after only describing it.
Vision
The Qwen 3.8 base supports image (and video) input via a separate
mmproj projector. Both halves ship in this repo:
Thanatos-27B.Q4_K_M.gguf (~16.8 GB, the text decoder)
Thanatos-27B.mmproj-f16.gguf (927.6 MB, the vision projector)
Use the bundled decoder. This repo's
Thanatos-27B.Q4_K_M.ggufis the heretic-ara Q4_K_M from mradermacher with this repo's chat template stamped in, MTP block kept — it is what the commands below use, and it saves a second ~17 GB download. The rawQwen3.8-27B-heretic-ara.Q4_K_M.ggufcarries the same tensors but upstream's template;make buildstamps this repo's template into any upstream quant.
The projector is mradermacher's Qwen3.8-27B-heretic-ara.mmproj-f16.gguf from
mradermacher/Qwen3.8-27B-heretic-ara-GGUF
byte-for-byte, shipped since 0.12.19 under this repo's naming. A clone without git-lfs
has a pointer file in its place: install git-lfs and run git lfs pull to replace it
with the real file, or let ./scripts/fetch_vision.sh fetch mradermacher's copy — the
same bytes, under the upstream name — without touching the tracked pointer. For
the vanilla pre-Heretic projector, see
unsloth/Qwen3.8-27B-GGUF
(mmproj-F16.gguf, ~927 MB); this repo does not redistribute that one.
Loader compatibility — the honest table
| Loader | Text | Vision (mmproj) | Notes |
|---|---|---|---|
llama.cpp (llama-mtmd-cli, llama-server --mmproj) | ✅ | ✅ | Reference path. Upstream has the qwen35/qwen35moe arch entries. |
| llama-cpp-python | ✅ | ✅ | See examples/llama_cpp_vision.py. |
| Ollama (live-tested: text on 0.33.3, 0.34.0 and 0.40.17, vision on 0.32.15, 0.33.3, 0.40.6 and 0.40.17; checked in source at 0.33.3, 0.34.0, 0.34.2 and 0.40.17) | ✅ | ✅ (0.32.15, 0.33.3, 0.40.6, 0.40.17) | Text: scripts/live_check.sh passed 17 of 17 on 0.33.3, on 0.34.0 (2026-09-11) and on 0.40.17 (2026-11-26), and 21 of 21 on 0.40.17 with the drafting check and the projector (2026-11-27; 48 of 100 drafted tokens accepted on the first generation). The version floor this row used to claim ("0.24+") was undated and unsourced; the versions named here are the checked set. Vision: works, and since 0.12.19 the hf.co/ pull carries the projector, so ollama run hf.co/FoolDev/Thanatos-27B-HERETIC takes images with no setup (pulled and tested on 0.40.17, 2026-11-26). The same projector attached through a local tag with two FROM lines also worked on 0.32.15, 0.33.3 and 0.40.6 — image answered, text-only requests unaffected; see Vision via Ollama. An earlier Ollama (0.22, May 2026) was observed failing: ollama create accepted the dual FROM and ollama show reported vision, but the first inference request failed with error loading model architecture: unknown model architecture: 'qwen35', which blocked text inference too. ollama/ollama#14575 closed as completed on 2026-08-04 (#15898 was closed as its duplicate and the sync PR #15899 closed unmerged); no version between that observation and 0.32.15 was tested. The cause this row used to give is wrong. There is no "C++ llama.cpp fallback" distinct from a Go engine: every GGUF model is served by the bundled llama-server (ollama/ollama#16031). At v0.33.3 (checked 2026-09-18), and again at v0.40.17, the source tree carries no vendored llama/llama.cpp/, and model/ holds only parsers/ and renderers/. Ollama's Go model code belongs to its MLX runner (x/models/ at v0.33.3, mlxrunner/model/ since), which serves only safetensors-format models (IsMLX() in server/images.go, unchanged since v0.33.3); 0.40.0 made it the default on Apple silicon for those, so this GGUF still runs on llama-server there. |
| LM Studio | ✅ | ✅ (last tested) | Uses upstream llama.cpp directly. |
Vision via llama.cpp
Three flavors, in order of build-time effort:
# A. HTTP via llama-server (always built — the easiest path).
# Reconfirmed working 2026-05-19 against llama.cpp 389ff61 + Vulkan
# on a Ryzen AI Max+ 395 / Radeon 8060S iGPU.
llama-server \
-m Thanatos-27B.Q4_K_M.gguf \
--mmproj Thanatos-27B.mmproj-f16.gguf \
--host 127.0.0.1 --port 8765 -c 8192 -ngl 99
# then POST OpenAI-style chat completions with an image_url content
# block — e.g. {"type":"image_url","image_url":{"url":"data:image/jpeg;base64,..."}}
# The thinking trace arrives in message.reasoning_content and the visible
# answer in message.content. Budget ≥500 max_tokens so the reasoning
# block does not crowd out the final answer.
# B. CLI via llama-mtmd-cli (one-shot). It is a separate cmake target,
# so a selective cmake --build build --target llama-cli ... will not
# produce it, but a plain cmake --build build will. If yours did not,
# run cmake --build build --target llama-mtmd-cli.
llama-mtmd-cli \
-m Thanatos-27B.Q4_K_M.gguf \
--mmproj Thanatos-27B.mmproj-f16.gguf \
--image photo.jpg \
-p "Describe this image."
# C. Python via llama-cpp-python:
python examples/llama_cpp_vision.py \
--gguf Thanatos-27B.Q4_K_M.gguf \
--mmproj Thanatos-27B.mmproj-f16.gguf \
--image /path/to/photo.jpg \
--prompt "What is in this image?"
Vision via Ollama
The hf.co/ pull includes the projector since 0.12.19, so
ollama run hf.co/FoolDev/Thanatos-27B-HERETIC takes images with no setup: HF's Ollama
bridge attaches Thanatos-27B.mmproj-f16.gguf as the tag's projector layer. Tested on
2026-11-26 with Ollama 0.40.17 (CPU only, isolated store): the pulled tag reported
completion, vision, tools and thinking with template source go_template, named
the red circle, the blue square and the word TOKYO in a test image on /api/chat, and
still answered text-only requests. A local tag built from this repo's Modelfile plus
the projector as a second FROM passed the same image and text prompts on Ollama
0.32.15, 0.33.3, 0.40.6 and 0.40.17 — on 0.40.17 also through /v1/chat/completions with
an image_url part and thinking on. Those runs, and the pull above, used the 0.12.x
blob without drafting;
the 0.13.0 file was tested this way, drafting, on 0.40.17 in the live check, and the
0.13.0 hf.co/ tag, pulled after upload, answered the image test while drafting. Send images as images on /api/chat or as an
image_url content part on /v1/chat/completions.
The projector costs memory even when you send only text: llama-server estimates its
worst case at about 1.1 GiB (1133 MiB, logged at load), on top of the figures in
Hardware requirements, and a fresh pull downloads 0.9 GB
more. A text-only tag avoids the load-time cost — build from the Modelfile (path B
under Ollama) or with scripts/cap_ctx.sh; neither carries the projector. A
git-lfs clone still downloads it, unless you clone with GIT_LFS_SKIP_SMUDGE=1 and then
git lfs pull --include=Thanatos-27B.Q4_K_M.gguf.
The Modelfile path stays text-only unless you add the projector yourself. The
first FROM must be the real bundled GGUF and p the real projector, not git-lfs
pointers (if ./scripts/load_bundle.sh fetched the GGUF for you, set g to the path
it printed; after ./scripts/fetch_vision.sh, set p to
$PWD/Qwen3.8-27B-heretic-ara.mmproj-f16.gguf):
mkdir -p .cache
awk -v g="$PWD/Thanatos-27B.Q4_K_M.gguf" \
-v p="$PWD/Thanatos-27B.mmproj-f16.gguf" \
'/^FROM[[:space:]]/ && !n { print "FROM " g; print "FROM " p; n = 1; next } { print }' \
Modelfile > .cache/Modelfile.vision
ollama create thanatos-vision -f .cache/Modelfile.vision
# should list Capabilities: completion, vision, tools, thinking
ollama show thanatos-vision
These commands were run as printed, in a mock clone against an isolated Ollama 0.40.17
(2026-11-26): ollama show listed vision with the Go template still selected.
The tag inherits the Modelfile's num_ctx 262144 (see
Hardware requirements). A /v1 client cannot lower that per
request — /v1 ignores options — so on a small host edit the PARAMETER num_ctx
line in .cache/Modelfile.vision before ollama create. The /v1 run above loaded at
262144 and completed, slowly, on the 27 GiB test host; that is not evidence it fits.
Hardware requirements
Janus is a 35B-A3B MoE since its 0.9.0, so its figures no longer transfer: 10 full-attention layers instead of 16 give it a far smaller KV cache (0.625 GiB per 32K f16), while its weights are larger at ~19.77 GiB.
This is a ~16.8 GB Q4_K_M GGUF. The table below was measured on 2026-09-18 on the
0.12.20 blob — the same tensors without the MTP block, which drafting needs (its cost
follows the table) —
Ollama 0.33.3's CPU backend, isolated store, CPU only, from llama.cpp's own allocation
lines at num_ctx 8192 / 32768 / 65536 and again under OLLAMA_KV_CACHE_TYPE=q8_0
with OLLAMA_FLASH_ATTENTION=1. (Earlier releases carried these figures measured on
the Janus sibling while it shared this architecture; they are now this model's own.)
| component | measured | scales with num_ctx? |
|---|---|---|
| Weights | 15.40 GiB (CPU model buffer 4935.19 MiB + CPU_REPACK 10835.16 MiB) | no |
| Recurrent state (48 linear-attention layers) | 149.62 MiB | no — identical at every context |
| KV cache, f16 (Ollama's default) | 65,536 B/token → 512 / 2048 / 4096 MiB at 8K / 32K / 64K, i.e. 2.0 GiB per 32K | yes, exactly linear |
| KV cache, q8_0 | 34,816 B/token → 1088 / 2176 MiB at 32K / 64K, i.e. 1.0625 GiB per 32K | yes, exactly linear |
| Compute buffer | 280.04 / 328.04 / 784.07 MiB at 8K / 32K / 64K (q8_0: 328.30 / 784.34) | yes, but not linearly |
Vision projector (hf.co/ tag since 0.12.19, or a local tag that adds it) | up to ~1.1 GiB — llama-server's own estimate at load (1132.71 MiB, Ollama 0.40.17), not a measured figure | no |
llama.cpp logs the cache as "16 layers", confirming only the full-attention layers are cached — the Janus sibling's MoE logs 10, and with 2 KV heads to this model's 4 (20,480 against 65,536 B/token) its KV is under a third of this one's at the same window.
MTP drafting, on by default since 0.13.0, costs memory while it runs. Measured on Ollama 0.40.17 (CPU only; f16 KV unless the row says q8_0), from llama.cpp's allocation lines and llama-server's resident memory:
with draft_num_predict 4 | measured | scales with num_ctx? |
|---|---|---|
| MTP block weights | +251 MiB (16021.46 against 15770.35 MiB of model buffers; with draft_num_predict 0 they are not loaded) | no |
| Recurrent state | 748.12 MiB instead of 149.62 — five copies, the current position plus four drafted ones | no |
| Draft context KV cache (one layer, f16) | 4,096 B/token → 128 / 256 MiB at 32K / 64K | yes, linear |
| Draft context compute buffer | 260.04 / 528.07 MiB at 32K / 64K | yes |
| llama-server resident memory | 19.04 GiB against 17.91 at num_ctx 32768, 21.24 against 19.93 at 65536 — 1.1–1.3 GiB more | grows with the window |
…with OLLAMA_KV_CACHE_TYPE=q8_0 (and flash attention, 2026-11-27) | 18.13 GiB against 16.90 at 32768, 18.99 against 17.74 at 65536 — 1.2 GiB more. The draft context's own cache stays f16 (128 / 256 MiB, the same 4,096 B/token); only the main cache halves | grows with the window |
The drafting cost was not measured at the 262144 default. The totals below are without
drafting; on a host where it does not fit, PARAMETER draft_num_predict 0 in a local tag
returns to them.
num_ctx | f16 cache (default) | q8_0 cache |
|---|---|---|
| 262144 (default) | 16.0 GiB KV, ~32.3 GiB total | 8.5 GiB KV, ~24.8 GiB total |
| 65536 | 4.0 GiB KV, 20.3 GiB total (measured) | 2.13 GiB KV, 18.4 GiB total (measured) |
| 32768 | 2.0 GiB KV, 17.9 GiB total (measured) | 1.06 GiB KV, 16.9 GiB total (measured) |
| 1010000 (needs YaRN) | 61.6 GiB KV, ~77.9 GiB total | 32.7 GiB KV, ~49.0 GiB total |
These are text-only totals without MTP drafting (add its cost above). The hf.co/ tag
also loads the vision projector, whose worst case llama-server estimates at ~1.1 GiB
(the projector row above).
The 32768 and 65536 rows are sums of measured parts. The 262144 and 1010000 rows extrapolate the KV cache — exact, since it is linear — and carry the compute buffer forward from 65536, the largest context measured; it grows faster than linearly between 32K and 64K, so treat those two rows as floors. It's extensible to 1,010,000, but this GGUF ships no YaRN rope-scaling, so positions past the 262144 native window use untrained RoPE and output degrades — reaching the 1.01M ceiling needs YaRN (see below); keep real work within ~262K otherwise.
Leave the model room to think. Thinking counts against num_ctx, and on a constrained
request it can run long. Asked for a 120-word explanation (make bench's third prompt until 0.13.3),
Thanatos generated 2,896–6,638 tokens, nearly all of it thinking and much of that
counting its draft's words, in four runs with a 32K window, two of them make bench's
(Ollama 0.40.17, 2026-11-26). With a 4,096-token window the same request ran out in all five runs,
done_reason=length and no answer, thinking effort low included; the sibling Janus
behaved the same, and sampling changes did not help it either. So the window this card
recommends for memory-tight hosts, and make cap-ctx bakes, is 32768: it covered every
run here. Qwen's card for this base allocates far more on agentic work (262,144 tokens
of reasoning and 131,072 of answer, within its 1M context), and the baked default stays
the full 262144 window. If memory forces a window below 32768, turn thinking off for
requests like that.
How to override it: ollama run has no -o flag, and OLLAMA_CONTEXT_LENGTH only sets a default the baked num_ctx overrides — so set it per-session from the interactive prompt (the model loads lazily on the first message, so /set applies before the default context is allocated):
ollama run hf.co/FoolDev/Thanatos-27B-HERETIC:Q4_K_M
>>> /set parameter num_ctx 32768
>>> /set parameter num_batch 256
Programmatic callers pass the same via the API options field: "options": {"num_ctx": 32768, "num_batch": 256} — but only on Ollama's own /api/chat. /v1/chat/completions ignores options entirely, so an OpenAI-compatible client needs a tag baked at the smaller context instead: make cap-ctx bakes one with those same two values, from the bundled blob and this repo's Modelfile.
| Hardware | Status |
|---|---|
| ≥48 GB RAM (CPU-only) | Works at the 262144 default (~32.3 GiB without drafting); 5.4–7.3 tok/s generation with MTP drafting, 4.6–5.0 without, on a Ryzen AI Max+ 395. A 32 GB host needs OLLAMA_KV_CACHE_TYPE=q8_0 (~24.8 GiB without drafting, tight) or num_ctx 65536 (20.3 GiB measured, about 1.3 GiB more with drafting) |
| RTX 3090 / 4090 24 GB | Works with partial offload — the ~32.3 GiB total at the 262144 default does not fit 24 GB; trim num_ctx for full offload |
| RTX 5090 32 GB | Works, full offload at higher quant (Q5/Q6) with a lower num_ctx than the 262144 default, ~30-50 tok/s |
| Mac Studio M2/M3 48 GB+ unified | Works at the default, ~15-25 tok/s (32 GB needs a lower num_ctx) |
| 32 GB unified-memory laptops (Mac M-series, Ryzen AI Max+, etc.) | Does not fit the 262144 default with the f16 cache; the q8_0 cache (~24.8 GiB, up to ~1.1 GiB more on the hf.co/ tag for the projector) is tight, num_ctx 65536 (18.4-20.3 GiB measured, about 1.3 GiB more with MTP drafting) is comfortable. make build QUANT=Q3_K_M (~13 GB) or a lower num_ctx for comfort. |
Most numbers in this table are estimates from comparable models; the
gradient is right but the absolute values will move ±20% with prompt
shape, KV cache type, and parallel-request count. Measure your own
machine with make bench (3-prompt mix, reports tok/s from Ollama's
eval_count / eval_duration so it's not stopwatch-noisy). On the current
blob, on a Ryzen AI Max+ 395 with Ollama 0.40.17's CPU backend (no GPU), make bench
measured 7.11 tok/s at Q4_K_M with MTP drafting and 4.9 without, 1.45× (2026-11-27,
one isolated daemon, the same file at draft_num_predict 4 and 0, the 32768-token window):
1,202 generated tokens in 169,041 ms against 1,490 in 303,568 ms, or 8.49 / 6.81 / 7.14
against 5.13 / 4.96 / 4.88 per prompt, with 42–60% of drafted tokens accepted. That is the
prompt mix of 0.13.3. Before it, the third prompt asked for "a 120-word explanation of
what a Bloom filter is"; the model spent most of its tokens counting its draft's words
one by one ("A(1) Bloom(2) filter(3) …"), text the MTP head predicts unusually well (89%
accepted), and that run gave 10.4 against 4.69 tok/s (2026-11-26), a 2.2× that overstated
the general gain. The current figure agrees with ordinary 300-token answers with thinking
off, 1.13–1.50× (see Architecture).
Until 0.13.1 the bench ran at a 4,096-token window, which that prompt filled without
answering in every run here (10.6 against 4.75 tok/s on 2026-11-26). On the 0.12.20
stripped blob, Ollama 0.33.3's CPU backend measured 5.08 tok/s (1,852 tokens in 364,560
ms, or 5.32 / 5.10 / 5.07, re-measured 2026-09-18 in an isolated store; a 0.12.0-era run
of the same bench gave 5.01) — that run's third prompt finished within the 4,096 window,
so these aggregates do not compare directly. On that blob the q8_0 KV cache cost nothing in speed — 5.22 and 5.12 tok/s on the first two
prompts of the same mix against 5.32 and 5.10 at f16; that pass was stopped before its
third prompt finished, so no q8_0 aggregate is published. The earlier data points on that machine's
Radeon 8060S iGPU under Vulkan — ~12.3 tok/s at Q3_K_S and ~9.3 tok/s
at Q4_K_M, with a ROCm snapshot of the Q3_K_S bench at ~10.1 tok/s — were
measured in May 2026 on the Qwen 3.6 27B builds, before both base swaps, and
have not been re-measured on the heretic-ara blob.
Prompt processing, measured on CPU only (Ollama 0.40.17, 2026-11-26). Same CPU,
isolated store, f16 KV cache, num_ctx 36864, timed from Ollama's own
prompt_eval_count / prompt_eval_duration on fresh prompts — each taken from a
different offset of the same text, so no cached prefix helps: ~43.5 tok/s at 2.3K
tokens, ~41.7 at 8.3K and ~33.1 at 34K. A 34K-token prompt read from scratch therefore
takes about 17 minutes on this CPU. These were measured on the 0.12.20 stripped blob,
without drafting; generation speed was unchanged on this Ollama then — the 0.40.17 live
check's generations ran at 5.05–5.07 tok/s.
GPU offload on a Strix Halo iGPU (Radeon 8060S): a small gain, and a trap. On a
Vulkan integrated GPU, llama.cpp - including the build Ollama 0.33.3 bundles - turns
mmap off and puts every layer it does not offload into GPU-reachable host memory from
the same pool as the GPU, so num_gpu alone does not limit GPU memory: a first attempt
with llama-server filled the pool and took the desktop down with it. With
LLAMA_ARG_NO_HOST=1 in the Ollama server's environment (llama.cpp's --no-host) those
layers stay in ordinary RAM. Measured that way on the Janus sibling when it was the same dense Qwen 3.8 27B architecture, 17.3 against 16.5 GB (a private Ollama 0.33.3
with the ollama-vulkan backend and OLLAMA_IGPU_ENABLE=1; flash attention, q8_0 KV
cache, num_ctx 4096, a short generation): 4.8 tok/s at num_gpu 4, 4.9 at 8, 5.3 at 16
and 5.7 at 24 (7.9 GiB of the GPU pool), against about 5.0 on CPU only; prompt processing
roughly doubled (61 against 30 tok/s). The step to 32 layers ran the 27 GiB host short of
RAM and was stopped: the GPU's GTT is system RAM, so offloading frees none. On a machine
like this, CPU-only is nearly as fast; if you try the GPU, set LLAMA_ARG_NO_HOST=1 and a
fixed num_gpu. The mechanism is reported upstream in
ggml-org/llama.cpp#27360, which
names --load-mode mmap as the other way out. Ollama 0.40.17 takes that route itself:
on a Vulkan integrated GPU it now starts llama-server with --load-mode mmap
(ollama/ollama#19640, from source — not
tested on a GPU here), which is expected to make the LLAMA_ARG_NO_HOST=1 override
unnecessary there. Until you have checked buffer placement on your own machine (no
Vulkan_Host model buffer in the server log), keep the override: the failure it
prevents takes the desktop down. For standalone llama-server, where #27360 is still
open (checked 2026-11-26), pass --load-mode mmap or --no-host yourself.
Reaching a coherent ~1.01M context (opt-in YaRN). The bundled GGUF ships no
YaRN rope-scaling, so raising num_ctx toward the 1.01M ceiling degrades past the
262144 native window. Ollama has no rope knob, so for a genuinely coherent long context run
the GGUF under llama.cpp with YaRN enabled:
llama-server -m Thanatos-27B.Q4_K_M.gguf \
--rope-scaling yarn --yarn-orig-ctx 262144 --rope-scale 3.853 -c 1010000
--rope-scale 3.853 ≈ 1010000 / 262144; use a smaller factor for a smaller
window. Static YaRN rescales all prompts, so enable it only when you actually
need > 262K — it slightly degrades short-context quality otherwise.
Chat template
Standard Qwen 3.x ChatML with <|im_start|> / <|im_end|> role markers
and <think>...</think> blocks for reasoning traces. The Qwen 3.8 jinja
template is embedded in the GGUF metadata; loaders that read GGUF chat
templates directly (llama.cpp, llama-cpp-python, LM Studio) handle the
plain-conversation formatting automatically.
Ollama is the exception: it picks between this repo's Go template and the embedded jinja at load time (see Which template Ollama runs). Two paths supply that Go template, depending on how you pull the model:
ollama run hf.co/FoolDev/Thanatos-27B-HERETIC— HF's Ollama bridge applies the root-leveltemplate/system/paramsfiles in this repo (the bridge does not readModelfile).make build/ollama create thanatos-27b -f Modelfile— uses theModelfile'sTEMPLATEblock.
Both routes wire .Tools / .ToolCalls and tools work end-to-end on
/api/chat and /v1/chat/completions. The two configurations are
kept in sync: edit them together if you change one.
Plain conversation
<|im_start|>system
You are Thanatos, a precise and capable assistant…<|im_end|>
<|im_start|>user
What is the time complexity of mergesort?<|im_end|>
<|im_start|>assistant
With reasoning trace
<|im_start|>assistant
<think>
The user asked about mergesort. It splits, recursively sorts each half,
then merges. The recurrence T(n) = 2T(n/2) + O(n) solves to O(n log n).
</think>
Mergesort runs in **O(n log n)** time in the worst, average, and best
cases.<|im_end|>
Most clients (Open WebUI, LibreChat, etc.) hide the <think> block by
default and surface only the visible answer. Strip it manually with
re.sub(r"<think>.*?</think>\s*", "", content, flags=re.DOTALL) if your
client doesn't.
Thinking is replayed across turns
Reasoning from earlier assistant turns is replayed back into the prompt, on both runtimes, so the model sees how it reached its previous answers. Reasoning from the turn in progress — including a tool-call chain, where the model calls a tool and then continues after the result — is kept whatever the setting, so it does not lose its own trace mid-flight.
- Ollama runs the Go template, which renders a
<think>…</think>block for every assistant message, earlier turns included — the condition is$.IsThinkSetalone, not gated on.Thinking, so a turn that did no reasoning renders an empty block rather than none. This departs from Qwen's stock condition, which drops reasoning from turns before the latest user message. Ollama never passes reasoning to the GGUF's embedded Jinja template, so on Ollama only the Go template decides. - llama.cpp runs
chat_template.jinja, which replays earlier turns' reasoning by default, as upstream's template does — including upstream's empty<think>\n\n</think>block for an earlier assistant turn that had no reasoning.
Your client has to send the reasoning back. The server returns it — Ollama's
/api/chat in the response's thinking field, llama.cpp in reasoning_content —
but a template can only replay what arrives in the next request, and each server
reads one field:
| Endpoint | Field read from each assistant message |
|---|---|
Ollama /api/chat | thinking |
Ollama /v1/chat/completions | reasoning only — reasoning_content and thinking are dropped silently; an assistant message whose content is an array of parts keeps its reasoning only if it also has tool_calls |
llama-server /v1/chat/completions | reasoning_content only |
LM Studio 0.4.24 /v1/chat/completions | reasoning or reasoning_content, passed to the template as reasoning_content; thinking is dropped |
KoboldCpp /v1/chat/completions (--jinja) | whatever the client sent — the template sees the message unchanged |
For loaders like KoboldCpp that pass the message through, chat_template.jinja
reads the reasoning from reasoning, then reasoning_content, then thinking
(the order the Janus sibling used while it still shipped its own Jinja template;
its 0.9.0 dropped that file); upstream's template read only reasoning_content,
so a trace sent as reasoning or thinking became an empty <think> block.
Checked on 2026-09-14 by rendering both templates with KoboldCpp's own Jinja setup
(from its koboldcpp.py, concedo branch 4ac5721) — the old one dropped both
fields, the new one replays them — and through LM Studio 0.4.24 with a
260K-parameter model on its CPU runtime, where the old and new templates rendered
the same because LM Studio normalises the field first.
Checked live on 2026-09-13 with the restamped blobs, CPU only: Ollama 0.33.3
replayed thinking on /api/chat (232 prompt tokens with it, 187 without) and
reasoning on /v1 (215 vs 187, measured with the Janus sibling's blob, whose Go
template is byte-identical) and ignored reasoning_content on /v1 (187);
llama-server master rendered reasoning_content and dropped a reasoning field.
Re-measured on this blob on Ollama 0.40.17 (2026-11-26) with the current template,
by scripts/live_check.sh: 233 against 190 on /api/chat, and a live tool-call
chain kept its reasoning at 377 against 334. The Go template has changed since the
2026-09-13 figures (0.12.5–0.12.8 edited template and the Modelfile's copy of it;
system has not changed), and a 0.33.3 live check on 2026-09-19, after those edits,
already gave these numbers — the shift is the template's.
That Ollama's /v1 also drops thinking, and the array-content rule, come from
Ollama's v0.33.3 and v0.34.0 source. openai/openai.go and server/prompt.go were
byte-identical from v0.33.3 through v0.34.2 and have changed since, but not in these
respects: at v0.40.17 the /v1 message type still reads only reasoning, and every
line that copies it into a message is unchanged (source, 2026-11-26).
Which llama.cpp an Ollama carries. 0.33.3 and 0.34.0 bundle b10760; 0.34.1
bundles b10864, 0.34.2 b10969, 0.40.17 b12257 and 0.40.18 b12651 (each release's
LLAMA_CPP_VERSION). From 0.34.1 on that is a b10763-or-later llama-server — the
family that passes preserve_reasoning=true by default — but it changes nothing here.
Correction (2026-09-18). This paragraph used to say that text inference runs "Ollama's
own Go engine" and that the bundled llama.cpp only comes into play when Ollama "falls back
to its C++ engine" once an mmproj is attached. There is no such split. Ollama has no Go inference engine for GGUF models and no separate C++ fallback: since ollama/ollama#16031 every GGUF model is served by the bundled llama-server subprocess, and the source tree carries no vendored llama/llama.cpp/ — model/ holds only parsers/ and renderers/ (checked at v0.33.3 on 2026-09-18 and at v0.40.17 on 2026-11-26). This paragraph also used to say the tree has "no Go model implementations at all"; it does, for the MLX runner (x/models/ at v0.33.3, mlxrunner/model/ since), which serves only safetensors-format models (IsMLX()), never a GGUF. So
LLAMA_CPP_VERSION names the engine for text as well, and the bundled llama-server is what
runs this model on every request. What keeps preserve_reasoning a non-event here is
unchanged: on the Ollama path the prompt is rendered by the Go template, not by the GGUF's
Jinja template (see Which template Ollama runs).
The cost is context. Every retained trace stays in the prompt, measured at 181 prompt tokens without / 464 with on a 3-message conversation whose first assistant turn carried a ~240-word trace. Prefill grows with every retained trace, and on a CPU-only host prefill is the slow part. Releases 0.7.0 through 0.8.1 turned replay off for that reason; the CHANGELOG has the history.
To turn it off on llama-server, start it with --no-reasoning-preserve, or
per request pass "chat_template_kwargs": {"preserve_thinking": false} (or
{"preserve_reasoning": false}). "preserve_thinking": true in a request turns
replay back on even against --no-reasoning-preserve. The template reads only
preserve_thinking; llama-server derives it from preserve_reasoning and
--no-reasoning-preserve. llama.cpp master (b10763 and later) passes
preserve_reasoning=true unless started with --no-reasoning-preserve and logs
"chat template supports preserving reasoning, it is enabled by default"; b10760
(the build Ollama 0.33.3 bundles) and b10519 pass nothing and log "consider
enabling it via --reasoning-preserve", yet still replay, because the template's
own default is on. Tested on 2026-09-13 with a 260K-parameter test model and
--chat-template-file (the template, not the model, decides the prompt), via
/apply-template and /v1/chat/completions, on master 4a89937 (b10941), b10760
and b10519 (LM Studio's avx2 CPU runtime 2.30.0): each of those settings behaved
as described, a live tool-call chain kept its reasoning in every mode, and no
request returned an error. On the restamped blob itself, with its embedded
template and default flags, llama-server master rendered a 3-message conversation
in 111 prompt tokens with the earlier turn's reasoning and 81 with
--no-reasoning-preserve or either false kwarg (85 with no reasoning sent, for
the empty think block), and a real tool-result turn with string arguments returned
HTTP 200. Re-checked on 2026-11-26 on b12257, the llama-server Ollama 0.40.17
bundles: it logs the same "enabled by default" line; with this template on the
stories260K test model an earlier turn's reasoning_content was rendered by default and
"chat_template_kwargs": {"preserve_thinking": false} dropped it; and on this blob a
real tool call came back parsed and its string-argument replay answered with HTTP 200
(see Tool / function calling).
To turn it off on Ollama, edit the assistant branch of the Modelfile /
template (both, so make check's bridge sync stays green): change
{{ if $.IsThinkSet -}} (the shipped condition) back to Qwen's stock
{{ if (and $.IsThinkSet (and .Thinking (or $last (gt $i $lastUserIdx)))) -}}
(keep the -}}; the $lastUserIdx loop at the top of the template is there for
it). check_go_template.py (check 9) will then fail, since it requires the
replay condition. Do not delete the block instead — see
Which template Ollama runs.
Disabling thinking
This is a reasoning-first model — it opens a <think> block by default. For a
direct answer with no reasoning trace (simple or latency-sensitive calls), turn
thinking off:
ollama run hf.co/FoolDev/Thanatos-27B-HERETIC:Q4_K_M --think=false
or send "think": false on /api/chat. With thinking off the model skips the
reasoning trace and answers straight into content; with it on (the default)
reasoning is emitted into the thinking field.
Reasoning effort
OpenAI-compatible clients can send reasoning_effort. Ollama's /v1 layer accepts
eight values. Where chat_template.jinja sees the value as sent (llama.cpp), it maps
each to one of three tiers or switches thinking off:
reasoning_effort | Effect |
|---|---|
high, xhigh, max, ultra | xhigh — the model is told to think carefully and check its assumptions |
medium, unset, null, anything unrecognised | medium — the default; no effort instruction is added |
low, minimal | low — the model is told to keep its thinking brief |
none | thinking off for that request, the same as "think": false |
The default changed in 0.12.4. Upstream's template treated an unset value as
xhigh and raised on anything it did not recognise; this template resolved unknown
values rather than raising, but kept the xhigh default — so the same request answered
at a different tier depending on which template rendered it: xhigh through llama.cpp,
medium through Ollama, where an unset think level adds no instruction at all. Both
paths now default to medium, and xhigh is something a client asks for explicitly.
Upstream accepted only xhigh, medium and low, so everything else failed —
including high, the value most OpenAI-compatible clients send; on Ollama, while it
ran the embedded template, that surfaced as HTTP 500.
On Ollama's default path the Go template runs instead (see
Which template Ollama runs), and it adds the same
instruction from Ollama's think level. Ollama folds the eight values into four
levels before any template sees them, so the Go template maps levels, not values:
high, xhigh, max and ultra get the xhigh line; low and minimal get the
low line; medium gets no line; none switches thinking off. (The four levels are
low/medium/high/max — xhigh and ultra reach the template as max. There is
no xhigh level; "xhigh" is this repo's name for the instruction text, so a hand-written
eq $.ThinkLevel "xhigh" could never fire.) Ollama sends an unset value as
medium, indistinguishable from an explicit medium, so the default adds no line —
which since 0.12.4 is exactly what chat_template.jinja does too. Send high for the
xhigh line on either path. "think": "high",
"low" and "max" on /api/chat map the same way. Mixed case such as "HIGH"
is rejected by Ollama itself with HTTP 400 before any template runs (from source).
Verified on
Ollama 0.33.3, 0.34.0 and 0.40.17 (2026-11-26) with scripts/live_check.sh, which sends /api/chat think levels: on a one-line chat, high and max
each added 38 prompt tokens and low 26, while medium and an unset value added
none — on 0.40.17, 158 prompt tokens unset or medium, 196 at high or max and 184
at low. The /v1 value-to-level mapping
above comes from Ollama's source: unchanged from v0.33.3 through v0.34.2 (2026-09-17),
and the same for this model at v0.40.17 (2026-11-26). There the clamp lives in
ThinkingFromReasoningEffort and the four-level check in api.ValidateLegacyThinking,
which applies to any model without per-model thinking metadata — and a model whose
config names no renderer, like this one, gets none on these paths (genericThinking()
in server/model_thinking.go). That layout dates from 0.34.3; in 0.34.2 and earlier the
clamp was thinkFromReasoningEffort, and ThinkValue's JSON decoding rejected other
names on /api/chat.
On llama.cpp every value except none reaches chat_template.jinja as sent;
llama-server handles none itself by switching thinking off. Tested on llama.cpp
master a2878d3: all eight values, "HIGH" and an unknown word each returned
HTTP 200 — nothing raises. An unset value takes the medium default and adds no
effort line; scripts/check_chat_template.py (check 8) pins that. The template
lower-cases and trims the value itself. LM Studio's CPU engine (llama.cpp
b10519) passed the same checks; the LM Studio app's own API layer is untested.
Which template Ollama runs
This repo ships two templates for the same ChatML model: the Go template (served
by HF's Ollama bridge) / Modelfile TEMPLATE, and chat_template.jinja, stamped
into the GGUF. They do not render identical prompts — the Go template pins JSON
tool calls and takes the reasoning-effort line from Ollama's think level, while the
Jinja template has its own tool instructions, uses the XML <function=…> form
unless a replayed call carries string arguments, and takes the line from the
request's reasoning_effort.
Ollama 0.33.3, 0.34.0 and 0.40.17 (all verified live) pick one at load time: they prefer the
embedded template when that advertises more capabilities — tools, thinking — and
keep the Go template when they tie. They tie, so Ollama runs the Go template; the rule has one more clause worth knowing — a Go template that renders a tool round trip is kept even when the embedded template advertises more, unless the embedded one renders a round trip too (shouldPreferChatTemplate, server/images.go);
llama.cpp and LM Studio run the embedded Jinja template. That selection code is
unchanged through v0.34.2 (source, 2026-09-17). At v0.40.17 it has one more clause —
a template that round-trips Mistral-style [CALL_ID] tool-call IDs wins a tie — which
Qwen's template does not match, and the 0.40 model-upgrade migration for
qwen35/qwen35moe only rewrites GGUFs that carry Ollama-specific keys, vision
tensors or Ollama-named mtp.* tensors. This one has none of them: its MTP block uses
llama.cpp's own blk.64.nextn.* names, and NeedsMigration in compatmigrate/qwen35.go
triggers only on Ollama's keys and on mtp. or v. tensor prefixes (2026-11-26). Ollama's
built-in renderers — it ships qwen3.5 and qwen3.8 ones — displace both templates
only when the
model's own config names a renderer or parser, which this repo's does not. Ollama logs
the choice:
msg="template selection" ... selected=go_template renderer="" parser="" go_template="[completion tools thinking]" ...
and from 0.40.7 ollama show <tag> prints it as well — template source go_template
under Model (template_source in /api/show). An open upstream PR,
ollama/ollama#17965, would stamp a
qwen3.5 renderer and parser into every qwen35 / qwen35moe model at create time;
if it lands, ollama show will report a different template source and this section
will no longer describe what runs (checked 2026-11-26: open, no approving review).
The Go template's "thinking" entry comes from its single .Thinking reference —
the block that renders assistant reasoning into the prompt. Removing it drops that
capability: Ollama switches to the embedded template, a single tool call can
come back twice (seen once, on the Janus sibling; cause inferred, not confirmed —
see Known limitations), and reasoning_effort suddenly selects
the Jinja template's tiers — under upstream's version of that template it raised
instead, which is what caused the HTTP 500s. That happened once; the CHANGELOG has
the details. Setting OLLAMA_GO_TEMPLATE=1 or =0 on the Ollama server forces one
template or the other for every model.
Both of those capabilities are read out of the template's parse tree, not out of anything
it renders, so a render diff cannot see either one break. Ollama takes the tool-call tag
from the first {{ if }} whose condition names .ToolCalls — anywhere in the file — and
then from the first literal text inside that block (tools/template.go, byte-identical
from v0.33.3 through v0.40.18). An action
at the head of the range .ToolCalls body leaves no text and the tag falls back to {,
which stops tool calling outright; that was 0.12.5. A condition naming .ToolCalls earlier
in the template captures the same search with the same result, which is why the assistant
branch aliases it once as {{ $calls := .ToolCalls }} and branches on the variable. The
thinking tags come from the first and last nodes of the list holding {{ .Thinking }}
(thinking/template.go; that function is unchanged through v0.40.18), and both must be
literal text: end that block with an {{ if }}
and the closing tag comes back empty, the thinking capability disappears, and Ollama answers
does not support thinking with HTTP 400. Since 0.12.7, scripts/check_go_template.py emulates
both functions and asserts the values they derive, so either regression fails make check
offline instead of waiting for a live tool call to expose it.
Tool / function calling
The model emits whichever shape the system prompt prescribes. The Ollama
path pins one — a JSON object inside <tool_call> tags. On llama.cpp,
chat_template.jinja chooses per conversation: XML (the model's native form)
when every tool argument is a mapping, JSON when a replayed call carries string
arguments — the case upstream's XML-only template cannot render (below).
Ollama path (this repo's Modelfile). The TEMPLATE directive
prompts the model to emit JSON-in-XML, the form Ollama's tool-call
extractor parses into a structured tool_calls array. After
make build, ollama show thanatos-27b lists tools and thinking
under Capabilities, and both /api/chat and /v1/chat/completions
accept a tools array. The tool definitions go in with {{ json .Function }}: on Ollama 0.14 and later a bare {{ .Function }} prints Go struct syntax instead of JSON (ollama/ollama#14601; fix proposed in ollama/ollama#18391). Still so at v0.40.18: template/template.go is byte-identical from v0.33.3, #14601 is still open and #18391 still has no review (checked 2026-11-26).
<tool_call>
{"name": "get_current_weather", "arguments": {"city": "Paris", "unit": "celsius"}}
</tool_call>
Embedded-jinja path (llama.cpp, llama-cpp-python, LM Studio). The
bundled GGUF already embeds chat_template.jinja, so this path works
as-is. It is the upstream Qwen 3.8 template — what you get from a
quant pulled straight from mradermacher/Qwen3.8-27B-heretic-ara-GGUF —
that emits the more verbose XML form:
<tool_call>
<function=get_current_weather>
<parameter=city>
Paris
</parameter>
<parameter=unit>
celsius
</parameter>
</function>
</tool_call>
Keep XML on llama-server. llama-server recognises this template as
Qwen3-Coder-style and parses the model's reply with a parser — and, once the
model opens <tool_call>, a grammar — that accept only
<function=…><parameter=…>. A prompt that teaches the JSON form gets replies
that parser cannot read. 0.7.0 to 0.9.0 defaulted to auto; 0.10.0 went back
to xml for that reason. Re-checked on b12257 (the llama-server Ollama 0.40.17
bundles, 2026-11-26): the server still logs Using specialized template: Qwen3-Coder
for this template, and that handler is now a PEG parser
(common/parsers/qwen3-coder.cpp) whose tool-call rule is still <function=…> +
<parameter=…> only, and whose lazy grammar still waits for <tool_call>.
Replayed tool calls render on llama-server. Every OpenAI-compatible client
hands assistant tool calls back with function.arguments as a JSON string,
and the XML parameter form needs the individual key/value pairs — a chat
template has tojson but no inverse. llama-server decodes the string into a
mapping before it renders the template, so the second turn of a tool call
renders in XML with no error. Tested on 2026-09-14 with a 260K-parameter test
model and this template, replaying a call whose arguments was the string
{"city": "Paris"}: /apply-template and /v1/chat/completions returned HTTP
200 with the call rendered as <parameter=city> on llama.cpp master 97e4ca7,
b10760 (the llama-server Ollama 0.33.3 bundles) and b10519 (LM Studio's avx2
CPU runtime 2.30.0), and again on b12257 (the one Ollama 0.40.17 bundles,
2026-11-26).
Other loaders, checked 2026-09-14. KoboldCpp v1.120 renders the template
with Python's jinja2 only when run with --jinja --jinja_tools (without
--jinja_tools, requests with tools skip the template), and parses JSON-string
arguments with json.loads first: with this template and a string-argument
replay it returned HTTP 200 and rendered the call as XML (tested with a
260K-parameter model). Jan runs llama.cpp's own server code — v0.8.4 downloads
llama-server from the janhq/llama.cpp fork (b9967), and its main branch links
ggml-org llama.cpp b10809 — so it inherits the conversion above (from source,
untested). The LM Studio app renders templates with its own JavaScript Jinja
engine rather than llama-server's, and also parses the arguments first: through
LM Studio 0.4.24's /v1/chat/completions (CPU runtime avx2 2.37.0, a 260K-parameter model
carrying this template) a string-argument replay returned HTTP 200 with the call
rendered as XML, and arguments that were not valid JSON returned HTTP 500
before the template ran, with or without tool_call_format: "auto". If a loader does raise, pass tool_call_format: "auto" in its
template kwargs, or change 'xml' to 'auto' in the template's
_tool_format default (in LM Studio, under the model's Prompt Template
setting).
A loader that hands the template the raw string instead cannot use the XML
form. Upstream's template applies the items filter to it and dies:
Can only get item pairs from a mapping.
chat_template.jinja is the base model's own template with three
deliberate changes, each marked CHANGED FROM UPSTREAM in the file. The
one that matters here: it gains a tool_call_format setting — xml (the
default), auto, or json. xml renders exactly upstream's form, and
raises a message that says what to do if it receives string arguments.
auto, the opt-in for loaders that pass them through, renders the prompt in
JSON form whenever a historical tool call carries string arguments and is
byte-identical to upstream's XML when every argument is a mapping —
mirroring what the Qwen 3.8 "safe" template does. Pass it with
--chat-template-kwargs '{"tool_call_format":"auto"}' or a request's
chat_template_kwargs. On llama-server auto changes nothing, because
arguments reach the template as mappings; do not set json there, for the
parser reason above.
The other two: reasoning_effort is normalised instead of validated (see
Reasoning effort), and an earlier turn's reasoning is read
from reasoning, then reasoning_content, then thinking (see Thinking is
replayed across turns). The vision handling and every other
upstream behaviour are unchanged, including replaying earlier turns' reasoning
by default (see Thinking is replayed across
turns).
llama-server -m Thanatos-27B.Q4_K_M.gguf \
--jinja --chat-template-file chat_template.jinja
With that flag the same client code should work against either server, as
long as both return a parsed tool_calls array — verified on Ollama and on
standalone llama-server (llama.cpp master a2878d3, under the earlier auto
default), and again on b12257 with the 0.12.x blob on 2026-11-26: asked "What is the
weather in Tokyo? Use the tool.", it returned exactly one parsed get_weather call
with {"city":"Tokyo"}, and the string-argument replay of that call was answered
with HTTP 200. On the 0.13.0 file b12257 returned the same parsed call with and without
--spec-type draft-mtp; the replay was not re-run on it. The prompt format underneath still differs, as above.
The bundled GGUF already carries this template — you do not need the flag.
Thanatos-27B.Q4_K_M.ggufhaschat_template.jinjastamped into its metadata, so a loader that reads the embedded template and parses Qwen's<tool_call>output gets working tool calls with no configuration: llama-server (tested on llama.cpp mastera2878d3, b10760 and b12257) and LM Studio's CPU runtime (llama.cpp b10519, tested). The 0.13.0 bundle, with its MTP block, was re-tested on b12257 (with and without--spec-type draft-mtp) and on LM Studio's b10519 and b10760 runtimes;a2878d3only ever ran the stripped bundle before it. llama-cpp-python renders the tools but, per its source, does not parse<tool_call>output intotool_calls. KoboldCpp (with--jinja --jinja_tools) was tested and Jan checked from source; see above../scripts/build.sh(make build) stamps it into every quant it builds, too. The--chat-template-fileflag above is only needed for a GGUF that was not built or stamped that way — a quant pulled straight from upstream, for instance. To restamp one you already have:python3 scripts/strip_mtp.py IN.gguf OUT.gguf --chat-template chat_template.jinja --keep-mtpWith
--keep-mtpthat rewrites the file purely to swap the template, keeping the MTP block as the bundle andmake builddo; without it an MTP-carrying input also loses the block. Tensor data is copied byte-for-byte either way, so there is no re-quantization.
End-to-end exercise (Ollama path):
# section 3 runs a real round-trip
python examples/ollama_chat.py
Known limitations
- On the embedded-template path, a single tool call can come back twice. On the Janus sibling, when it shared this dense Qwen 3.8 27B base, Ollama 0.33.3 running the embedded template returned a first-turn tool call twice in one test. A separate raw generation on Janus showed the model drafting the call inside
<think>before emitting it once after</think>, so the parser most likely matched such a draft (inferred, not confirmed). On standalone llama.cpp master (a2878d3, CPU) it did not reproduce on either model: six first-turn calls per model (three prompts, with and withoutparallel_tool_calls) and a streamed run each came back exactly once. Nor did it on Janus under b10760, the llama.cpp build Ollama 0.33.3 bundles and the one the duplicate came through. LM Studio's CPU engine (llama.cpp b10519) passed the same checks; the LM Studio app's own API layer is untested. On Ollama's default path — the Go template, see Which template Ollama runs — a first-turn tool call on this model returned exactly one call. If your client executes tools wherever the embedded template renders (llama.cpp, LM Studio, or Ollama withOLLAMA_GO_TEMPLATE=0), drop identical consecutive calls. - Dense, so every parameter runs on every token. There is no expert sparsity to hide behind: the ~16 GiB weights-plus-compute footprint is a floor, not an average, and per-token throughput is what a full 27B forward pass costs. Trim
num_ctxto fit a smaller host — there is no expert-offload trick to fall back on. (The Janus sibling went back to being a ~3B-active MoE in its 0.9.0, so it does offer a cheaper per-token forward pass — at a larger resident footprint.) - The projector rides along on the
hf.co/tag. Since 0.12.19 everyhf.co/pull downloads it (0.9 GB), and llama-server estimates its worst-case memory at ~1.1 GiB even for text-only requests. For a text-only tag build from theModelfileor withscripts/cap_ctx.sh(see Vision via Ollama). Ollama versions before 0.32.15 were not tested with it; on 0.22 (May 2026) an attached projector made the first request fail, text included (see the loader table). - Q4_K_M quality loss is real. Use Q5_K_M or Q6_K if you have the VRAM (~20-22 GB).
- Large tool-call arguments can be dropped. Ollama's JSON-in-XML tool format makes the model JSON-escape the entire arguments object inline; for a big/complex payload (e.g. a file's
contentin awrite_filecall) the model can fail to escape it, so the field arrivesundefinedand the call fails. Qwen's native<function=…><parameter=…>format (raw values, no escaping) was tested as a fix but parses unreliably through Ollama, so the Go template deliberately keeps JSON-in-XML (chat_template.jinjakeeps the native form; see Tool / function calling). Mitigation: write large files in smaller pieces per call. - No formal evaluation in this card. Most numbers are estimates; the
make benchtok/s figures are measured: 7.11 with MTP drafting and 4.9 without at Q4_K_M on CPU for the current blob (Ollama 0.40.17, 2026-11-27; see Hardware requirements), and ~12.3 at Q3_K_S / ~9.3 at Q4_K_M under Vulkan on the May 2026 pre-rebase builds. - Uncensored base. The heretic-ara abliteration dials back the refusal-training of upstream Qwen 3.8. Outputs may be more compliant with sensitive requests than the vanilla base; the Thanatos system prompt still steers behavior, but the safety floor is lower. Apply your own filtering for user-facing deployments.
Related models
| Model | Notes |
|---|---|
| heretic-org/Qwen3.8-27B-heretic-ara | Immediate base, safetensors |
| mradermacher/Qwen3.8-27B-heretic-ara-GGUF | Recommended GGUF source (what make build pulls from) |
| cygnal/Qwen3.8-27B-heretic-ara-Q4_K_M-MTP-GGUF | Same heretic-ara abliteration but keeps the MTP head (for the llama.cpp MTP path / speculative decoding) |
| Qwen/Qwen3.8-27B | Upstream pre-Heretic base, safetensors |
| unsloth/Qwen3.8-27B-GGUF | Pre-Heretic GGUF mirror + reference mmproj-F16.gguf projector |
| FoolDev/Janus-35B-HERETIC | Sibling, and since its 0.9.0 a different model: llmfan46's Qwen 3.6 35B-A3B MoE (~34.7B total / ~3B active), abliterated MPOA-style rather than ARA. Larger resident footprint, much smaller KV cache; the -35B- slug is accurate. |
| Crownelius/Crow-9B-HERETIC-4.6 | 9B starter model when 27B is too heavy |
Credits
- Immediate base: heretic-org/Qwen3.8-27B-heretic-ara — Heretic-style (ARA) abliteration of Qwen 3.8 27B
- Upstream base: Qwen/Qwen3.8-27B (Alibaba)
- Vision projector:
Qwen3.8-27B-heretic-ara.mmproj-f16.gguffrom mradermacher/Qwen3.8-27B-heretic-ara-GGUF, redistributed unchanged asThanatos-27B.mmproj-f16.gguf - Reasoning teacher: Claude Fable 5 (Anthropic)
- Distillation lineage and dataset curation: Crownelius
License inherited from upstream: Apache-2.0.