Slonik

Agentic Coding Models Trained in PostgreSQL Environments
Postgres Professional
November 2026

Technical report (PDF)

Slonik-27B weights
Slonik-9B weights
Apache 2.0

Database engines are critical infrastructure, yet their development remains an underexplored setting for coding agents. A PostgreSQL patch must connect systems code with behavior exposed through SQL; successful compilation alone does not establish correctness. Existing database environments often study tuning or SQL debugging, while engine-development tasks require changes to the database implementation itself.

Slonik comprises two language models for agentic coding (Slonik-27B, Slonik-9B), developed at Postgres Professional. We use PostgreSQL engine development to train the models, then test whether their gains extend to general software engineering tasks.

Model Details

PostgreSQL supplies source-level repair tasks, built-in C function tasks, extension tasks, executable feedback for training. The models undergo continued pretraining, supervised fine-tuning, then reinforcement learning with test-based rewards.

Model Starting checkpoint Evaluated RL checkpoint
Slonik-27B Qwen3.8-27B DAPO update 116
Slonik-9B Qwen3.5-9B DAPO update 177

The starting checkpoints belong to different backbone families, so the comparison does not isolate parameter count. Both models are available as complete BF16 checkpoints in this repository.

The Slonik-9B run later reached update 397, which has no complete five-suite evaluation in this report. Its SWE-bench score at update 177 is provisional; one evaluation round completed 55 of 58 tasks.

Download and Run

Model Folder Format
Slonik-27B 27B/ BF16 Safetensors
Slonik-9B 9B/ BF16 Safetensors

Each folder contains a complete model with its tokenizer, chat template, configuration files. Select 27B or 9B through the subfolder argument.

Transformers

These examples use Transformers 5.9.0 with Accelerate 1.14.0. Install a PyTorch build appropriate for your hardware.

pip install "transformers==5.9.0" "accelerate==1.14.0"
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer

model_id = "dglhf/Slonik"
subfolder = "27B"
tokenizer = AutoTokenizer.from_pretrained(model_id, subfolder=subfolder)
model = AutoModelForImageTextToText.from_pretrained(
    model_id, subfolder=subfolder, dtype=torch.bfloat16, device_map="auto",
)
model.eval()

messages = [{"role": "user", "content": "Explain how PostgreSQL MVCC visibility works."}]
prompt = tokenizer.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True, enable_thinking=False,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
    outputs = model.generate(
        **inputs, max_new_tokens=512, do_sample=True,
        temperature=1.0, top_p=0.95, top_k=20,
    )
print(tokenizer.decode(outputs[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))

Set subfolder = "9B" to load Slonik-9B. Both checkpoints retain the qwen3_5 architecture. Evaluation concerns text/code workflows; retained vision components are outside its scope.

vLLM

Download the selected folder with snapshot_download.

from huggingface_hub import snapshot_download

snapshot_download(
    "dglhf/Slonik",
    allow_patterns=["27B/*", "LICENSE", "NOTICE", "licenses/*"],
    local_dir="./Slonik",
)
vllm serve ./Slonik/27B \
  --served-model-name Slonik-27B \
  --language-model-only --max-model-len 32768 \
  --enable-auto-tool-choice --tool-call-parser qwen3_coder \
  --default-chat-template-kwargs '{"enable_thinking": false}'

For Slonik-9B, replace 27B with 9B in the download pattern, local path, served model name. Set tensor parallelism to match your GPU configuration. The calling agent supplies tool execution, the conversation loop, task environments.

Uses

The intended tasks are code investigation, patch generation, debugging within tool-using software agents. Evaluation covers text/code workflows.

Training Details

Slonik training pipeline

  1. Continued pretraining. The selected corpus contains 517 million tokens drawn from a roughly 5-billion-token inventory of PostgreSQL material, systems code, database literature, general replay. Identified evaluation overlap is excluded.
  2. Supervised fine-tuning. Full-parameter training uses 725 agent dialogues with successful tool interactions over executable software tasks.
  3. Agent reinforcement learning. DAPO uses 494 training tasks. Each update retains 16 informative groups of eight attempts. Hidden verification assigns binary rewards. Groups with identical rewards are discarded. LoRA uses rank 16 with scaling 16.

The agent harness is Markov, based on Goose. Uni-Agent connects agent trajectories to verl, with vLLM serving. Training uses eight NVIDIA H200 GPUs in verl's colocate_async mode. Generation shares the GPU pool with optimization, pauses for weight updates, then resumes. Unfinished episodes can cross policy updates; recorded token probabilities support rollout correction.

The Slonik-27B run completed approximately 54 hours of RL on eight H200 GPUs.

Evaluation

Benchmarks

PG17 contains 36 held-out tasks, comprising 18 PostgreSQL 17 repairs plus 18 built-in SQL function implementations in C. It evaluates tasks closest to the PostgreSQL training environments. Repeated evaluation on this suite informed model selection.

PG18 contains 53 separately mined PostgreSQL 18 fixes. It tests transfer to a later release within the same database codebase, moving beyond the PostgreSQL 17 selection suite.

Apache AGE contains 57 tasks in a PostgreSQL graph database extension. It moves evaluation from the database core to a separate extension codebase. Together, PG17, PG18, Apache AGE probe progressively greater changes in task context relative to training.

SWE-bench Verified uses a local 58-task subset of repository-level software issues. It tests whether training in PostgreSQL environments improves issue resolution in software projects outside the training domain.

Terminal-Bench 2.0 uses 56 eligible tasks from a nominal 58-task subset; two tasks were excluded following sandbox failures. Its command-line workflows test generalization to software environments outside PostgreSQL. The public benchmark results concern these local subsets.

Evaluation limits

The evaluation uses a 60-turn limit with a 28,000-token prompt budget. Terminal-Bench additionally enforces its task-specific agent timeouts. Slonik decoding uses temperature 1.0, top-p 0.95, top-k 20. GLM uses low reasoning effort.

Results

Slonik benchmark comparison

Benchmark results from the technical report, pass@1 (%).

Model PG17 PG18 Apache AGE SWE-bench Verified subset Terminal-Bench 2.0 subset
Slonik-27B 55.6 43.4 36.6 73.3 45.8
Slonik-9B 40.3 15.1 16.7 54.3 14.3
GLM-5.3-Flash 51.9 39.9 42.1 69.0 47.3
DeepSeek-V4-Flash 50.9 25.8 19.3 52.9 36.9
Qwen3.8-27B 31.2 8.8 14.6 53.4 32.1
GPT-6-Luna* β€” 56.6 42.1 β€” β€”

* GPT-6-Luna uses Codex, with default reasoning, one attempt per task, no 28,000-token cap. All other models use Markov, a Goose-based agent harness, under the limits above.

Generalization

A separate paired comparison of Slonik-27B against its exact supervised starting checkpoint estimates gains of +10.7 percentage points on PG17, +20.5 on PG18, +5.6 on Apache AGE, +21.6 on the SWE-bench Verified subset. All four reported 95% task-bootstrap intervals exclude zero; the SWE interval is [14.2, 29.7] percentage points. This supports transfer to the measured general software tasks under the recorded harness. The paired study uses a different evaluation snapshot from the cross-model table.

Slonik-9B improves from 21.9% to 40.3% on PG17 relative to its supervised checkpoint. Its comparisons use unequal repetition counts; the 27B confidence intervals do not apply to the 9B results.

Limitations

PG17 informed model selection; several transfer suites were inspected repeatedly. Decontamination covers project-controlled data, not the unknown contents of the original backbone corpora. Hidden tests provide finite checks, so measured task success does not establish production readiness for database changes.

License

The model weights, configuration files and loading examples are released under the Apache License 2.0. The upstream licenses are preserved under licenses/, with attribution and modifications described in NOTICE. This license statement concerns the model release; the report, illustrations and embedded fonts retain their respective rights and notices.

Authors

Dmtriy Gilemkhanov, Vladlen Popolitov, Saveliy Baturin, Dmitrii Tarasov, Oleg Bartunov
Postgres Professional

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Paper for dglhf/Slonik