# PSA: Gemma 4 12B is NOT completely broken for coding and tool calling, you need a special chat template — retained record

> Retained reddit record from reddit:LocalLLaMA.

Canonical: https://highsignal.app/data/records/2a66a417ad538a5b

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:LocalLLaMA)  published 2026-06-05 17:31 ingested 2026-06-06 08:28

[original source ↗](https://www.reddit.com/r/LocalLLaMA/comments/1txro73/psa_gemma_4_12b_is_not_completely_broken_for/)

## retained text



```
<!-- SC_OFF --><div class="md"><p>This is a PSA for people like me who tried it and hit the wall with tool calls failing left and right, so much so that harnesses like OpenCode just didn't work:</p> <p>There is a fix for that. You need to pass a better chat template file, <a href="https://gist.github.com/jscott3201/ad69c4ffbd79f18b11a0f6a94c94fadf">which is available</a> (I did not write it). <a href="https://www.reddit.com/r/LocalLLaMA/comments/1twmw4o/comment/oppmvdg/">See also this comment.</a></p> <p>To actually use it with llama.cpp, <strong>first compile llama.cpp from source,</strong> then download the chat template file I linked above, then try this (8 bit quant in this case):</p> <pre><code>./build/bin/llama-server -hf unsloth/gemma-4-12b-it-GGUF:UD-Q8_K_XL --host 127.0.0.1 --port 8899 --jinja --chat-template-file ./custom-pub-chat-template-gemma4.jinja </code></pre> <p>I'm not saying the results are great, or good, or better or worse than Qwen 3 9B or any other model! But with this setting, the tool calling bugs go away and you can genuinely evaluate its capabilities in opencode.</p> <p>So, please do that before forming a judgement of the model's coding ability.</p> <p>But once you've done that, judge away 😀</p> <p>I'm posting because I see so many &quot;I can't code with Gemma 4 12B, tool calls never work&quot; comments that it's tough to cut through the noise when discussing the model.</p> <p>Thanks to <a href="/u/HVACcontrolsGuru">u/HVACcontrolsGuru</a> for bringing the solution to my attention. I hope I'm not stealing their thunder, just thought it was time to call more eyeballs to this.</p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/boutell"> /u/boutell </a> <br /> <span><a href="https://www.reddit.com/r/LocalLLaMA/comments/1txro73/psa_gemma_4_12b_is_not_completely_broken_for/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/LocalLLaMA/comments/1txro73/psa_gemma_4_12b_is_not_completely_broken_for/">[comments]</a></span>
```



document fetched 2026-06-06 08:28
