Text Generation
GGUF
Safetensors
English
Turkish
plc
iec-61131-3
structured-text
code-generation
ollama
mikrodev
ALB
AdvanceLogicBuilder
MikrodevLogicStudio
advance-logic-builder
mikrodev-logicstudio
gemma
conversational
Instructions to use Mikrodev/stcoder-gemma4-12b-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Mikrodev/stcoder-gemma4-12b-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
Use Docker
docker model run hf.co/Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Mikrodev/stcoder-gemma4-12b-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mikrodev/stcoder-gemma4-12b-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mikrodev/stcoder-gemma4-12b-gguf", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
- Ollama
How to use Mikrodev/stcoder-gemma4-12b-gguf with Ollama:
ollama run hf.co/Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
- Unsloth Studio
How to use Mikrodev/stcoder-gemma4-12b-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mikrodev/stcoder-gemma4-12b-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mikrodev/stcoder-gemma4-12b-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Mikrodev/stcoder-gemma4-12b-gguf to start chatting
- Docker Model Runner
How to use Mikrodev/stcoder-gemma4-12b-gguf with Docker Model Runner:
docker model run hf.co/Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
- Lemonade
How to use Mikrodev/stcoder-gemma4-12b-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Mikrodev/stcoder-gemma4-12b-gguf:Q4_K_M
Run and chat with the model
lemonade run user.stcoder-gemma4-12b-gguf-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -35,14 +35,18 @@ stcoder-gemma4-12b is a Gemma-4-12B-it fine-tune that writes Mikrodev LogicStudi
|
|
| 35 |
|
| 36 |
If you are choosing for the first time, start with [`Mikrodev/stcoder-qwen25-7b-gguf`](https://huggingface.co/Mikrodev/stcoder-qwen25-7b-gguf) at **Q8_0** instead (the fastest per answer of the four (5.8 s), 15/15 delivery, and the highest ChrF among the models that answered every prompt (38.5)). Come to this model for the reasons listed under *Is this the right model for you?*.
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
>
|
| 47 |
> **Always compile generated code in ALB / LogicStudio before deployment.** The model produces
|
| 48 |
> dialect-correct code, which is not the same as correct control logic.
|
|
@@ -72,14 +76,14 @@ slower generation.
|
|
| 72 |
|---|---|---|---|
|
| 73 |
| `lora_adapter/` | The LoRA adapter this model was trained as β PEFT adapter on the base model above. Merge it yourself, stack it, or continue training from it. | small | being uploaded |
|
| 74 |
| f16 merged weights | f16 is the merged fine-tune at full precision: the reference build, for evaluation or for producing your own quantisations. | 22.17 GiB | not shipped - rebuild from the adapter (snippet below) |
|
| 75 |
-
| `Modelfile` | One ready-to-run Ollama definition:
|
| 76 |
| `article_stcoder-gemma4-12b.html`, `article_stcoder-gemma4-12b.docx` | The full evaluation report for this model. | |
|
| 77 |
|
| 78 |
## Quick start with Ollama
|
| 79 |
|
| 80 |
-
Requires **Ollama 0.
|
| 81 |
|
| 82 |
-
> Gemma
|
| 83 |
|
| 84 |
**1. Install Ollama**
|
| 85 |
|
|
@@ -122,8 +126,36 @@ You get a body-only `iecst` block: `VAR` declarations plus logic, millisecond `I
|
|
| 122 |
positional function-block calls, no `PROGRAM` wrapper. Paste it into ALB / LogicStudio and compile.
|
| 123 |
|
| 124 |
For a different build, download that GGUF instead and change the Modelfile's `FROM` line to its
|
| 125 |
-
filename (the Modelfile lists the alternatives at the top).
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
## Use the LoRA adapter directly
|
| 129 |
|
|
@@ -251,6 +283,10 @@ and limitations β ships in this repo:
|
|
| 251 |
- Undecided readers, and anyone choosing on measured quality alone. Take the line's default, stcoder-qwen25-7b at Q6_K (5.82 GiB): in this head-to-head it leads on composite (0.844) and on ChrF at full delivery (38.5 over 15 of 15), and it is the fastest per answer at 5.8 s. If you want the one model that was 100% rule-clean in both conditions, take stcoder-qwen25-14b at Q4_K_M (8.37 GiB), accepting the lowest head-to-head ChrF (34.9) and the slowest generation per token (about 50 tok/s).
|
| 252 |
- 8 GiB cards. Q4_K_M weights alone are 6.87 GiB, leaving no useful context budget; use stcoder-qwen25-7b at Q6_K (5.82 GiB) instead.
|
| 253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
## Limitations of the evaluation
|
| 255 |
|
| 256 |
- **Quantisation was not matched.** This fine-tune ran at Q6_K; the stock base ran at the
|
|
@@ -271,10 +307,22 @@ and limitations β ships in this repo:
|
|
| 271 |
|
| 272 |
A curated in-house multi-task PLC corpus (approximately 2,930 training and 550 validation examples)
|
| 273 |
focused on Structured Text generation, written against the ALB / Mikrodev LogicStudio rule set. The
|
| 274 |
-
dataset is not publicly released.
|
| 275 |
|
| 276 |
Prompts are mostly English with a Turkish minority (10.8% of training prompts contain Turkish). Code, identifiers and code comments are always English; the model's conversational prose follows the language you write in.
|
| 277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
## Licence and attribution
|
| 279 |
|
| 280 |
apache-2.0. Fine-tuned from [`google/gemma-4-12b-it`](https://huggingface.co/google/gemma-4-12b-it); the base
|
|
|
|
| 35 |
|
| 36 |
If you are choosing for the first time, start with [`Mikrodev/stcoder-qwen25-7b-gguf`](https://huggingface.co/Mikrodev/stcoder-qwen25-7b-gguf) at **Q8_0** instead (the fastest per answer of the four (5.8 s), 15/15 delivery, and the highest ChrF among the models that answered every prompt (38.5)). Come to this model for the reasons listed under *Is this the right model for you?*.
|
| 37 |
|
| 38 |
+
| At a glance | |
|
| 39 |
+
|---|---|
|
| 40 |
+
| Take this build | **Q8_0** β `gemma4_12b-tc.q8_0.gguf`, 11.80 GiB, wants 13.8 GiB free |
|
| 41 |
+
| Dialect-clean replies | **86.7%** against 6.7% for the stock base |
|
| 42 |
+
| Speed | 8.5s per reply, 401 output tokens (median 360) |
|
| 43 |
+
| Runs on | Ollama 0.32+ (tested on 0.32.5), llama.cpp β CPU, GPU or Apple unified memory |
|
| 44 |
+
| Trained for | Mikrodev / ALB Structured Text only β body-only, no POU wrappers, INT milliseconds |
|
| 45 |
+
|
| 46 |
+
> **Tool calling is not supported on this release.** These are chat models: you describe a plant
|
| 47 |
+
> requirement, they reply with Structured Text. It was trained, measured and then dropped as a
|
| 48 |
+
> product decision β the numbers and the reasoning are under *Not the right tool for*. Do not build
|
| 49 |
+
> an agent on them.
|
| 50 |
>
|
| 51 |
> **Always compile generated code in ALB / LogicStudio before deployment.** The model produces
|
| 52 |
> dialect-correct code, which is not the same as correct control logic.
|
|
|
|
| 76 |
|---|---|---|---|
|
| 77 |
| `lora_adapter/` | The LoRA adapter this model was trained as β PEFT adapter on the base model above. Merge it yourself, stack it, or continue training from it. | small | being uploaded |
|
| 78 |
| f16 merged weights | f16 is the merged fine-tune at full precision: the reference build, for evaluation or for producing your own quantisations. | 22.17 GiB | not shipped - rebuild from the adapter (snippet below) |
|
| 79 |
+
| `Modelfile` | One ready-to-run Ollama definition: the system prompt, the sampling defaults and `num_ctx 8192` (the sequence length this model was trained at). It deliberately carries **no chat template** β Ollama uses its built-in `gemma4` renderer, which matches the chat template stored inside the GGUF, so the chat format is the trained one and cannot drift out of sync with this file. Its `FROM` points at the Q8_0 file; edit that one line if you downloaded a different quant. | small | in this repo |
|
| 80 |
| `article_stcoder-gemma4-12b.html`, `article_stcoder-gemma4-12b.docx` | The full evaluation report for this model. | |
|
| 81 |
|
| 82 |
## Quick start with Ollama
|
| 83 |
|
| 84 |
+
Requires **Ollama 0.32 or newer**.
|
| 85 |
|
| 86 |
+
> Gemma 4 support in Ollama is recent - an older build cannot load this architecture at all. Verified on 0.32.5, where Ollama formats the chat with its built-in `gemma4` renderer.
|
| 87 |
|
| 88 |
**1. Install Ollama**
|
| 89 |
|
|
|
|
| 126 |
positional function-block calls, no `PROGRAM` wrapper. Paste it into ALB / LogicStudio and compile.
|
| 127 |
|
| 128 |
For a different build, download that GGUF instead and change the Modelfile's `FROM` line to its
|
| 129 |
+
filename (the Modelfile lists the alternatives at the top).
|
| 130 |
+
|
| 131 |
+
With llama.cpp instead of Ollama, run `llama-cli -m <file>.gguf --jinja` and pass the same system
|
| 132 |
+
prompt. **`--jinja` matters:** it makes llama.cpp use the chat template stored inside the GGUF β the
|
| 133 |
+
one this model was trained with β instead of guessing a format.
|
| 134 |
+
|
| 135 |
+
## What the fine-tune actually changes
|
| 136 |
+
|
| 137 |
+
One prompt from the study below, sent to the stock base and to this fine-tune under the same short
|
| 138 |
+
system prompt that lists **no** dialect rules:
|
| 139 |
+
|
| 140 |
+
> *We've got a conveyor with a pre-start warning horn. When the operator hits the start button I need the horn to sound for 5 seconds first, then the motor kicks in and the horn goes quiet.*
|
| 141 |
+
|
| 142 |
+
The stock base answered with named function-block parameters and a TIME literal β constructs the Mikrodev runtime rejects:
|
| 143 |
+
|
| 144 |
+
```iecst
|
| 145 |
+
t_WarningTimer(IN := x_SystemActive, PT := T#5s);
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
This fine-tune, same prompt, no rules in the prompt:
|
| 149 |
+
|
| 150 |
+
```iecst
|
| 151 |
+
tPreStart(TRUE, 5000);
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
Positional function-block call, delay as an `INT` in milliseconds, no wrapper β the dialect came out
|
| 155 |
+
of the weights, not out of the prompt. Both snippets are verbatim from the recorded run.
|
| 156 |
+
|
| 157 |
+
> These lines show **dialect**, not correctness. R24 certifies that no forbidden construct appears;
|
| 158 |
+
> it does not check that the logic works. Read *Weaknesses* before you trust an answer.
|
| 159 |
|
| 160 |
## Use the LoRA adapter directly
|
| 161 |
|
|
|
|
| 283 |
- Undecided readers, and anyone choosing on measured quality alone. Take the line's default, stcoder-qwen25-7b at Q6_K (5.82 GiB): in this head-to-head it leads on composite (0.844) and on ChrF at full delivery (38.5 over 15 of 15), and it is the fastest per answer at 5.8 s. If you want the one model that was 100% rule-clean in both conditions, take stcoder-qwen25-14b at Q4_K_M (8.37 GiB), accepting the lowest head-to-head ChrF (34.9) and the slowest generation per token (about 50 tok/s).
|
| 284 |
- 8 GiB cards. Q4_K_M weights alone are 6.87 GiB, leaving no useful context budget; use stcoder-qwen25-7b at Q6_K (5.82 GiB) instead.
|
| 285 |
|
| 286 |
+
Those tool-call figures come from a separate internal evaluation that is not part of this release β
|
| 287 |
+
not from the code study reported above, whose own data and method ship with this model as the
|
| 288 |
+
detailed report.
|
| 289 |
+
|
| 290 |
## Limitations of the evaluation
|
| 291 |
|
| 292 |
- **Quantisation was not matched.** This fine-tune ran at Q6_K; the stock base ran at the
|
|
|
|
| 307 |
|
| 308 |
A curated in-house multi-task PLC corpus (approximately 2,930 training and 550 validation examples)
|
| 309 |
focused on Structured Text generation, written against the ALB / Mikrodev LogicStudio rule set. The
|
| 310 |
+
dataset is not publicly released.
|
| 311 |
|
| 312 |
Prompts are mostly English with a Turkish minority (10.8% of training prompts contain Turkish). Code, identifiers and code comments are always English; the model's conversational prose follows the language you write in.
|
| 313 |
|
| 314 |
+
| Training setting | Value |
|
| 315 |
+
|---|---|
|
| 316 |
+
| Method | LoRA (PEFT) supervised fine-tune |
|
| 317 |
+
| LoRA rank / alpha | 32 / 32 (dropout 0.0) |
|
| 318 |
+
| Epochs | 3 |
|
| 319 |
+
| Learning rate | 0.0002 |
|
| 320 |
+
| Sequence length | 8192 tokens |
|
| 321 |
+
| Effective batch | 8 (batch 1 x grad-accum 8) |
|
| 322 |
+
|
| 323 |
+
The published LoRA adapter is exactly this run's output, so anything above can be reproduced or
|
| 324 |
+
continued from it.
|
| 325 |
+
|
| 326 |
## Licence and attribution
|
| 327 |
|
| 328 |
apache-2.0. Fine-tuned from [`google/gemma-4-12b-it`](https://huggingface.co/google/gemma-4-12b-it); the base
|