| ---
|
| license: apache-2.0
|
| license_link: https://ai.google.dev/gemma/docs/gemma_4_license
|
| base_model: unsloth/gemma-4-12b-it
|
| base_model_relation: finetune
|
| pipeline_tag: text-generation
|
| language:
|
| - en
|
| tags:
|
| - gguf
|
| - llama.cpp
|
| - gemma
|
| - python
|
| - code
|
| - reasoning
|
| - conversational
|
| ---
|
|
|
| # Instinct-Python-Coder-Gemma4-12B-GLM5.2
|
|
|
| Instinct-Python-Coder-Gemma4-12B-GLM5.2 is a general-purpose Python coder that thinks
|
| briefly, then answers. We took the highly capable Gemma 4 12B model and taught it
|
| to perform better in Python coding with _much_ more concise reasoning in its
|
| `<think></think>` channel, leading to faster inference, a shorter context window,
|
| and cost savings for the end user. The reasoning style is distilled from GLM-5.2:
|
| the model works through the approach in a few lines, then hands back the code.
|
|
|
| ## Evaluation
|
|
|
| We measured first-attempt accuracy on a held-out set of 228 Python tasks: one
|
| greedy completion per task, each graded automatically.
|
|
|
| | | Gemma 4 12B (base) | Instinct |
|
| | --------------------------------------- | ------------------ | --------------- |
|
| | Solved | 40 / 228 (17.5%) | 85 / 228 (37.3%) |
|
| | Ran out of budget without writing code | 90 | 1 |
|
| | Time to run the full set (batched) | 233.6 min | 51.7 min |
|
|
|
| With a 37.3% first-attempt accuracy, our Python Coder Instinct model preserved 49% of
|
| GLM-5.2's thinking capability: GLM-5.2 itself reaches about 75.6% first-attempt
|
| accuracy on a broader Python pool under the same kind of check. For comparison,
|
| the base Gemma 4 12B model has only 17.5% accuracy, so we more than doubled it.
|
|
|
| On 90 of the 228 tasks the base model exhausted its budget without ever writing
|
| code; Instinct did that once. The same concise reasoning is why the full set
|
| evaluates 4.5x faster.
|
|
|
| ## Training
|
|
|
| Fine-tuned on 4.52M post-training tokens, passed over twice for 9.03M tokens in
|
| total, at a sequence length of 8,192.
|
|
|
| ## Limitations
|
|
|
| This is one 12B model measured once with greedy decoding, so treat 37.3% as a
|
| single reading with no error bar. It was tuned and tested on Python, and nothing
|
| else was measured here. It inherits Gemma 4's behavior and limitations.
|
|
|
| ## License and lineage
|
|
|
| Base model: [unsloth/gemma-4-12b-it](https://huggingface.co/unsloth/gemma-4-12b-it), which ships
|
| under the **Apache 2.0** license (see its own model card's frontmatter — `license: apache-2.0`),
|
| not the standard Gemma Terms of Use. This fine-tune inherits that Apache 2.0 license.
|
|
|
| ## Usage
|
|
|
| It ships as a single Q8_0 GGUF, roughly 13 GB on disk, and runs on a GPU or Mac
|
| with about 16 GB of memory. Serve it with llama.cpp:
|
|
|
| ```bash
|
| llama-server -m Instinct-Python-Coder-Gemma4-12B-GLM5.2-Q8_0.gguf -ngl 99 -c 8192
|
| ```
|
|
|
| That exposes an OpenAI-compatible endpoint at `http://localhost:8080/v1`, and the
|
| Gemma 4 chat template is baked into the GGUF, so turns and the thinking channel are
|
| formatted for you. It runs anywhere GGUF runs, and any tool that speaks the OpenAI
|
| chat API can drive it:
|
|
|
| - **Runtimes and apps**: llama.cpp, Ollama, LM Studio, Jan, KoboldCpp
|
| - **Coding agents and harnesses**: opencode, pi, Hermes, Aider, Cline, Continue
|
|
|
| Describe what you want in plain language and it replies with a short pass of
|
| reasoning followed by the code:
|
|
|
| ````
|
| User: Merge two sorted lists into one sorted list.
|
|
|
| <think>
|
| Two pointers, take the smaller head each step, append whatever is left over. O(n+m).
|
| </think>
|
|
|
| ```python
|
| def merge(a, b):
|
| i = j = 0
|
| out = []
|
| while i < len(a) and j < len(b):
|
| if a[i] <= b[j]:
|
| out.append(a[i]); i += 1
|
| else:
|
| out.append(b[j]); j += 1
|
| out.extend(a[i:])
|
| out.extend(b[j:])
|
| return out
|
| ```
|
| ````
|
| |