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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- de
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
library_name: transformers
|
| 7 |
+
base_model:
|
| 8 |
+
- Qwen/Qwen2.5-Coder-14B
|
| 9 |
+
- Qwen/Qwen2.5-Coder-32B
|
| 10 |
+
tags:
|
| 11 |
+
- code
|
| 12 |
+
- coding
|
| 13 |
+
- tool-calling
|
| 14 |
+
- code-generation
|
| 15 |
+
- eu-trained
|
| 16 |
+
- dpo
|
| 17 |
+
- sft
|
| 18 |
+
- qlora
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
+
model-index:
|
| 21 |
+
- name: Kode
|
| 22 |
+
results: []
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# Kode β EU-Trained Coding Models
|
| 26 |
+
|
| 27 |
+
**Kode** is a family of instruction-tuned coding models built for real-world software engineering tasks. Fine-tuned on **Qwen2.5-Coder** using DPO + SFT with Claude-generated training samples on A100 GPUs.
|
| 28 |
+
|
| 29 |
+
Kode is the backbone of [Kode CLI](https://github.com/kevco/kode), an open-source local alternative to Claude Code.
|
| 30 |
+
|
| 31 |
+
| Model | Parameters | VRAM | Best For |
|
| 32 |
+
|-------|-----------|------|----------|
|
| 33 |
+
| **kode-14b** | 14B | ~10 GB (Q8) / ~9 GB (Q4) | Consumer GPUs, fast iteration |
|
| 34 |
+
| **kode-32b** | 32B | ~19 GB (Q4) | Maximum quality, production use |
|
| 35 |
+
|
| 36 |
+
## Key Features
|
| 37 |
+
|
| 38 |
+
- πͺπΊ **Trained in the EU** β DSGVO/GDPR compliant, no data leaves Europe
|
| 39 |
+
- π§ **Tool-calling native** β Trained specifically for file operations, shell commands, code search
|
| 40 |
+
- π― **Production code focus** β Training data from real codebases, not synthetic benchmarks
|
| 41 |
+
- π **7 languages** β Rust, Go, TypeScript, Python, C#, SQL, CSS/Tailwind
|
| 42 |
+
- π **Runs locally** β 14B fits on a single consumer GPU (RTX 3080+)
|
| 43 |
+
|
| 44 |
+
## Supported Languages & Tasks
|
| 45 |
+
|
| 46 |
+
### Languages
|
| 47 |
+
Rust β’ Go β’ TypeScript β’ Python β’ C# β’ PostgreSQL β’ CSS/Tailwind
|
| 48 |
+
|
| 49 |
+
### Tasks
|
| 50 |
+
- **Code generation** β Complete functions, modules, and files from natural language
|
| 51 |
+
- **Code refactoring** β Improve existing code structure and performance
|
| 52 |
+
- **Code review** β Identify bugs, security issues, and improvements
|
| 53 |
+
- **Tool calling** β File I/O, shell commands, grep/search (Kode CLI integration)
|
| 54 |
+
- **Code completion** β Context-aware completions
|
| 55 |
+
|
| 56 |
+
## Training Details
|
| 57 |
+
|
| 58 |
+
### Base Model
|
| 59 |
+
[Qwen2.5-Coder](https://huggingface.co/Qwen/Qwen2.5-Coder-32B) (14B and 32B variants)
|
| 60 |
+
|
| 61 |
+
### Training Pipeline
|
| 62 |
+
1. **SFT (Supervised Fine-Tuning)** β Claude-generated training samples across 7 languages (~841 curated queries covering data structures, async, error handling, APIs, testing, and more)
|
| 63 |
+
2. **DPO (Direct Preference Optimization)** β Preference pairs from Claude evaluations of model outputs
|
| 64 |
+
3. **Tool-call SFT** β Specialized training for tool-calling patterns (read_file, write_file, bash_execute, grep, etc.)
|
| 65 |
+
|
| 66 |
+
### Infrastructure
|
| 67 |
+
- **GPU:** NVIDIA A100 80GB (2Γ for 32B full fine-tune, 1Γ for QLoRA)
|
| 68 |
+
- **Framework:** Transformers + PEFT + TRL + Unsloth
|
| 69 |
+
- **LoRA config (32B):** r=64, alpha=128, dropout=0.05, targeting all attention + MLP projections
|
| 70 |
+
- **Precision:** bfloat16
|
| 71 |
+
- **Sequence length:** 4096 tokens
|
| 72 |
+
|
| 73 |
+
### Training Data
|
| 74 |
+
- ~841 curated training queries across 7 programming languages
|
| 75 |
+
- Claude-generated reference solutions (chosen) vs. local model outputs (rejected) for DPO
|
| 76 |
+
- Bilingual prompts (English + German)
|
| 77 |
+
|
| 78 |
+
## Usage
|
| 79 |
+
|
| 80 |
+
### Ollama (Recommended)
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
# Install and run
|
| 84 |
+
ollama pull simplellm/kode-14b
|
| 85 |
+
ollama run simplellm/kode-14b
|
| 86 |
+
|
| 87 |
+
# Or the larger model
|
| 88 |
+
ollama pull simplellm/kode-32b
|
| 89 |
+
ollama run simplellm/kode-32b
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
### Ollama API
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
curl http://localhost:11434/api/chat -d '{
|
| 96 |
+
"model": "simplellm/kode-14b",
|
| 97 |
+
"messages": [
|
| 98 |
+
{"role": "user", "content": "Write a Rust function to find prime numbers using the Sieve of Eratosthenes"}
|
| 99 |
+
]
|
| 100 |
+
}'
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### π€ Transformers
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 107 |
+
|
| 108 |
+
model_name = "simplellm/kode-14b"
|
| 109 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 110 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 111 |
+
model_name,
|
| 112 |
+
torch_dtype="auto",
|
| 113 |
+
device_map="auto",
|
| 114 |
+
trust_remote_code=True,
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
messages = [
|
| 118 |
+
{"role": "system", "content": "You are a coding assistant. Respond with clean, production-ready code."},
|
| 119 |
+
{"role": "user", "content": "Write a thread-safe LRU cache in Rust using Arc and Mutex"},
|
| 120 |
+
]
|
| 121 |
+
|
| 122 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 123 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 124 |
+
outputs = model.generate(**inputs, max_new_tokens=2048, temperature=0.7, top_p=0.9)
|
| 125 |
+
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True))
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
### llama.cpp
|
| 129 |
+
|
| 130 |
+
```bash
|
| 131 |
+
# Download GGUF
|
| 132 |
+
wget https://huggingface.co/simplellm/kode-14b-GGUF/resolve/main/kode-14b-Q8_0.gguf
|
| 133 |
+
|
| 134 |
+
# Run
|
| 135 |
+
./llama-cli -m kode-14b-Q8_0.gguf -p "Write a Go HTTP server with middleware" -n 1024
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
### Hosted Inference
|
| 139 |
+
|
| 140 |
+
Try Kode without downloading at **[SimpleLLM.eu](https://simplellm.eu)** β EU-hosted, GDPR-compliant inference API.
|
| 141 |
+
|
| 142 |
+
## Quantized Versions
|
| 143 |
+
|
| 144 |
+
| Variant | Size | Quality | Speed |
|
| 145 |
+
|---------|------|---------|-------|
|
| 146 |
+
| kode-14b (FP16) | ~28 GB | Baseline | Baseline |
|
| 147 |
+
| kode-14b-Q8 | ~15 GB | Near-lossless | ~1.2Γ faster |
|
| 148 |
+
| kode-14b (Q4) | ~9 GB | Good | ~1.5Γ faster |
|
| 149 |
+
| kode-32b (native/FP16) | ~64 GB | Best | Slowest |
|
| 150 |
+
| kode-32b-Q4 | ~19 GB | Very good | Fast |
|
| 151 |
+
|
| 152 |
+
## Benchmarks
|
| 153 |
+
|
| 154 |
+
> π§ **Coming soon** β We are running HumanEval, MBPP, MultiPL-E, and tool-calling benchmarks. Results will be published here.
|
| 155 |
+
|
| 156 |
+
| Benchmark | kode-14b | kode-32b | Qwen2.5-Coder-14B (base) |
|
| 157 |
+
|-----------|----------|----------|--------------------------|
|
| 158 |
+
| HumanEval | TBD | TBD | TBD |
|
| 159 |
+
| MBPP | TBD | TBD | TBD |
|
| 160 |
+
| MultiPL-E (Rust) | TBD | TBD | TBD |
|
| 161 |
+
| Tool-call accuracy | TBD | TBD | N/A |
|
| 162 |
+
|
| 163 |
+
## Limitations
|
| 164 |
+
|
| 165 |
+
- Optimized for the 7 supported languages; may underperform on others
|
| 166 |
+
- 4096 token context window (inherited from training config)
|
| 167 |
+
- Tool-calling format is specific to Kode CLI's tool schema
|
| 168 |
+
- Training data is bilingual (EN/DE) β other languages may have reduced quality
|
| 169 |
+
|
| 170 |
+
## License
|
| 171 |
+
|
| 172 |
+
Apache 2.0 (inherited from [Qwen2.5-Coder](https://huggingface.co/Qwen/Qwen2.5-Coder-32B))
|
| 173 |
+
|
| 174 |
+
## Citation
|
| 175 |
+
|
| 176 |
+
```bibtex
|
| 177 |
+
@misc{kode2025,
|
| 178 |
+
title={Kode: EU-Trained Coding Models for Real-World Software Engineering},
|
| 179 |
+
author={Kevin and SimpleLLM Team},
|
| 180 |
+
year={2025},
|
| 181 |
+
url={https://huggingface.co/simplellm/kode-14b}
|
| 182 |
+
}
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
## Links
|
| 186 |
+
|
| 187 |
+
- π [SimpleLLM.eu](https://simplellm.eu) β Hosted inference
|
| 188 |
+
- π» [Kode CLI](https://github.com/kevco/kode) β Local coding assistant
|
| 189 |
+
- π€ [All models](https://huggingface.co/simplellm) β HuggingFace collection
|