Zen Coder 4B - Advanced coding assistant
0
stars
152
commits
Python
primary language
Sep 9, 2026
updated
license: apache-2.0 language:
Agentic coding AI by Zen LM — from edge to frontier
🤗 HuggingFace | 📖 Docs | 💻 GitHub
Zen Coder is Zen LM's family of code-focused AI models, spanning three capability tiers from edge deployment to frontier performance. The flagship model, zen-coder-480b-instruct, is a 480B-parameter Mixture of Experts (MoE) model with 35B active parameters, delivering state-of-the-art results on agentic coding, browser-use, and tool-use benchmarks.
zen5-flash — fastest tierzen5-mini — balanced smallzen5 — defaultzen5-coder — code-specializedzen5-pro — high-quality reasoningzen5-max — flagshipzen5-nano-0.8Bzen5-nano-2Bzen5-nano-4Bzen5-nano-9Bzen5-embedding-0.6Bzen5-embedding-4Bzen5-embedding-8Bzen3-omni, zen3-vl (+ sizes), zen3-webzen-3-asr, zen-3-asr-0.6B, zen-3-asr-aligner, zen-3-tts, zen-3-tts-0.6B, zen-3-tts-voice-design, zen-3-tts-custom-voicezen3-guardzen3-image familyzen3-nanopip install transformers torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "zenlm/zen-5-coder-gguf"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Write a quicksort algorithm in Python with type hints."
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(**model_inputs, max_new_tokens=4096)
generated_ids = [
output_ids[len(input_ids):]
for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "zenlm/zen-5-coder-gguf"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto").eval()
# Structure: prefix + suffix + middle token
input_text = """<|fim_prefix|>def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
<|fim_suffix|>
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)<|fim_middle|>"""
messages = [
{"role": "system", "content": "You are a code completion assistant."},
{"role": "user", "content": input_text}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
eos_token_ids = [151659, 151661, 151662, 151663, 151664, 151643, 151645]
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=512,
do_sample=False,
eos_token_id=eos_token_ids
)[0]
output_text = tokenizer.decode(
generated_ids[len(model_inputs.input_ids[0]):],
skip_special_tokens=True
)
print(output_text)
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "zenlm/zen-5-coder-gguf" # 4B, 32K context
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
messages = [{"role": "user", "content": "Write a binary search in Rust."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(output[0][len(inputs.input_ids[0]):], skip_special_tokens=True))
ABAP, ActionScript, Ada, Agda, Alloy, ApacheConf, AppleScript, Arduino,
Assembly, Awk, Batchfile, C, C#, C++, COBOL, CSS, Clojure, CoffeeScript,
Dart, Dockerfile, Elixir, Elm, Erlang, F#, FORTRAN, Go, GraphQL, Groovy,
HTML, Haskell, Java, JavaScript, Julia, Kotlin, Lua, Makefile, Markdown,
NSIS, Nginx, OCaml, Objective-C, PHP, Pascal, Perl, PowerShell, Prolog,
Python, R, Racket, Ruby, Rust, SQL, Scala, Shell, Solidity, Swift,
TypeScript, VHDL, Verilog, Vue, WebAssembly, YAML, Zig, and 300+ more
| Benchmark | zen-coder-480b | zen-coder-flash |
|---|---|---|
| SWE-bench Verified | State-of-the-art | 59.2% |
| AIME 2025 | Competitive | 91.6% |
| GPQA | Competitive | 75.2% |
| t²-Bench | Competitive | 79.5% |
| Model | VRAM | Notes |
|---|---|---|
| zen-coder (4B) | 8GB | Full precision, single GPU |
| zen-coder-flash (31B MoE) | 24GB | Efficient MoE, 3B active |
| zen-coder-480b-instruct | 8x 80GB | Tensor parallel recommended |
Apache 2.0
@misc{zenlm2025zen-coder,
title={Zen Coder: Agentic Coding AI by Zen LM},
author={Hanzo AI and Zoo Labs Foundation},
year={2025},
publisher={HuggingFace},
howpublished={\url{https://huggingface.co/zenlm/zen-5-coder-gguf}}
}
Zen LM by Hanzo AI - Clarity Through Intelligence
zenlm.org |
HuggingFace |
GitHub
Python
92.7%
Shell
6.8%
Zen Coder 4B - Advanced coding assistant
0
stars
152
commits
Python
primary language
Sep 9, 2026
updated
license: apache-2.0 language:
Agentic coding AI by Zen LM — from edge to frontier
🤗 HuggingFace | 📖 Docs | 💻 GitHub
Zen Coder is Zen LM's family of code-focused AI models, spanning three capability tiers from edge deployment to frontier performance. The flagship model, zen-coder-480b-instruct, is a 480B-parameter Mixture of Experts (MoE) model with 35B active parameters, delivering state-of-the-art results on agentic coding, browser-use, and tool-use benchmarks.
zen5-flash — fastest tierzen5-mini — balanced smallzen5 — defaultzen5-coder — code-specializedzen5-pro — high-quality reasoningzen5-max — flagshipzen5-nano-0.8Bzen5-nano-2Bzen5-nano-4Bzen5-nano-9Bzen5-embedding-0.6Bzen5-embedding-4Bzen5-embedding-8Bzen3-omni, zen3-vl (+ sizes), zen3-webzen-3-asr, zen-3-asr-0.6B, zen-3-asr-aligner, zen-3-tts, zen-3-tts-0.6B, zen-3-tts-voice-design, zen-3-tts-custom-voicezen3-guardzen3-image familyzen3-nanopip install transformers torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "zenlm/zen-5-coder-gguf"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Write a quicksort algorithm in Python with type hints."
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(**model_inputs, max_new_tokens=4096)
generated_ids = [
output_ids[len(input_ids):]
for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "zenlm/zen-5-coder-gguf"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto").eval()
# Structure: prefix + suffix + middle token
input_text = """<|fim_prefix|>def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
<|fim_suffix|>
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)<|fim_middle|>"""
messages = [
{"role": "system", "content": "You are a code completion assistant."},
{"role": "user", "content": input_text}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
eos_token_ids = [151659, 151661, 151662, 151663, 151664, 151643, 151645]
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=512,
do_sample=False,
eos_token_id=eos_token_ids
)[0]
output_text = tokenizer.decode(
generated_ids[len(model_inputs.input_ids[0]):],
skip_special_tokens=True
)
print(output_text)
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "zenlm/zen-5-coder-gguf" # 4B, 32K context
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
messages = [{"role": "user", "content": "Write a binary search in Rust."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(output[0][len(inputs.input_ids[0]):], skip_special_tokens=True))
ABAP, ActionScript, Ada, Agda, Alloy, ApacheConf, AppleScript, Arduino,
Assembly, Awk, Batchfile, C, C#, C++, COBOL, CSS, Clojure, CoffeeScript,
Dart, Dockerfile, Elixir, Elm, Erlang, F#, FORTRAN, Go, GraphQL, Groovy,
HTML, Haskell, Java, JavaScript, Julia, Kotlin, Lua, Makefile, Markdown,
NSIS, Nginx, OCaml, Objective-C, PHP, Pascal, Perl, PowerShell, Prolog,
Python, R, Racket, Ruby, Rust, SQL, Scala, Shell, Solidity, Swift,
TypeScript, VHDL, Verilog, Vue, WebAssembly, YAML, Zig, and 300+ more
| Benchmark | zen-coder-480b | zen-coder-flash |
|---|---|---|
| SWE-bench Verified | State-of-the-art | 59.2% |
| AIME 2025 | Competitive | 91.6% |
| GPQA | Competitive | 75.2% |
| t²-Bench | Competitive | 79.5% |
| Model | VRAM | Notes |
|---|---|---|
| zen-coder (4B) | 8GB | Full precision, single GPU |
| zen-coder-flash (31B MoE) | 24GB | Efficient MoE, 3B active |
| zen-coder-480b-instruct | 8x 80GB | Tensor parallel recommended |
Apache 2.0
@misc{zenlm2025zen-coder,
title={Zen Coder: Agentic Coding AI by Zen LM},
author={Hanzo AI and Zoo Labs Foundation},
year={2025},
publisher={HuggingFace},
howpublished={\url{https://huggingface.co/zenlm/zen-5-coder-gguf}}
}
Zen LM by Hanzo AI - Clarity Through Intelligence
zenlm.org |
HuggingFace |
GitHub
Python
92.7%
Shell
6.8%