Skip to content
MechresPublic

About

LLM inference engine and OpenAI/Anthropic-compatible server written from scratch in Rust, with its own Vulkan compute kernels (optional HIP backend). Runs GGUF models - Inkling 2 Mini, Qwen3.5/3.8 hybrids, LFM, 29B MoE - on consumer AMD GPUs with speculative decoding and long contexts.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Ocak

Ocak (Turkish: hearth, forge) is an LLM inference engine and API server written from scratch in Rust. It runs GGUF models on the GPU through its own Vulkan compute kernels — no CUDA, ROCm or llama.cpp needed to build or run — with an optional HIP backend and an x86-64 CPU fallback. It serves OpenAI- and Anthropic-compatible APIs, so tools like the OpenAI SDKs, Open WebUI or Claude Code can use local models directly.

It is developed on, and tuned for, a consumer AMD desktop (Ryzen 5 5600, Radeon RX 6700 XT 12 GB, Mesa RADV), and runs models from 1.7B to 29B parameters, including Mixture-of-Experts models larger than the card's VRAM.

Highlights

  • Own GPU kernels. ~80 GLSL compute shaders (int8 dot-product matmuls, flash attention, split-K decode attention, fused norms, MoE dispatch) driven through raw Vulkan (ash). One GPU submit per generated token.
  • Wide model support. Llama / Qwen2, Liquid LFM2 / LFM3, Qwen3.5 / Qwen3.8 hybrids (Gated DeltaNet + attention), Xing4.0 29B MoE (MLA), Inkling-2-Mini 26B looped MoE, Qwen3-ASR speech recognition. 21 weight formats, from F32 down to 1.58-bit PTQ1_0.
  • Speculative decoding. Native NextN MTP draft heads, verified to be lossless (greedy output is identical with MTP on and off).
  • Long contexts on a 12 GB card. Paged 8-bit KV cache, radix-tree prefix reuse, optional KV in system RAM, and MoE experts spilled to host memory when they do not fit.
  • API server. OpenAI chat / completions / embeddings / audio, Anthropic Messages, streaming, tool calling (incl. forced tool_choice), JSON mode, reasoning budgets, continuous batching of up to 8 requests, Prometheus metrics, a web dashboard and a terminal monitor.
  • Power aware. Unloads idle models and releases the GPU (RX 6700 XT back to ~29 W idle), reloading in a few hundred milliseconds on the next request.

Supported models

Architecture Example models Notes
gemma4 Gemma 4 E2B, E4B, 12B, 26B-A4B (MoE), 31B local/global layers with 256/512-wide heads, shared KV layers, per-layer embeddings, logit soft-cap; text only; Vulkan and CPU
gemma3 Gemma 3 1B / 4B / 27B (12B untested) sliding-window + global layers, GeGLU, post-norms; text only
qwen3moe Qwen3-30B-A3B (128 experts, 8 used) softmax router + routed experts; experts spill to host memory on small GPUs; Vulkan and CPU
phi3 Phi-3 / Phi-3.5 mini fused QKV and gate/up, LongRoPE
olmo2 OLMo 2 0425 1B (and larger) no pre-norms, whole-vector QK-norm; Vulkan and CPU
gemma2 Gemma 2 2B / 9B (27B not supported) attention and final logit soft-caps, local/global alternation; Vulkan and CPU
llama, qwen2, qwen3 MiniCPM5, Llama, Qwen2, Qwen3 (0.6B-32B dense) dense GQA, QK-norm
lfm2, lfm3 LFM2.5-2.6B, LFM3-1.7B short convolutions + attention
qwen35 Qwen3.5-4B, Qwen3.8-27B, Ornith, RVN, Ternary-Bonsai Gated DeltaNet hybrid, NextN MTP
xing4_0 Xing4.0-29B-A4B 64-expert MoE, MLA attention, hyper-connections
inkling2_loop Inkling-2-Mini (26.4B) looped 128-expert MoE, NVFP4
qwen3a + qwen3vl Qwen3-ASR-1.7B speech to text (/v1/audio/transcriptions)

Other architectures can be served through a managed llama-server bridge.

Performance

RX 6700 XT, Vulkan backend, ocak bench --prompt-tokens 512 --decode-tokens 64 (decode measured after the 512-token prompt; full tables, HIP numbers and method in docs/BENCHMARKS.md):

Model Size Prefill (tok/s) Decode (tok/s)
LFM3-1.7B Q6_K 1.5 GB 3785 181
MiniCPM5-2B Q4_K_M 1.5 GB 2780 160
Qwen3.5-4B Q4_K_M 2.6 GB 1880 100
Ornith-1.5-9B Q4_K_M (with MTP) 5.4 GB 1001 113
Qwen3.8-27B UD-IQ2_S 7.8 GB 306 36
Xing4.0-29B-A4B IQ3_XXS (MoE) 10.8 GB 985 42

Against llama.cpp's Vulkan backend on the same card, Ocak is 5-27% faster on the Qwen3.5-family hybrid models (Qwen3.8-27B: 306 vs 243 tok/s prefill, 36 vs 29 tok/s decode), about level on small-model decode, and 10-18% behind on small dense models' prefill.

Quickstart

Requirements: Rust (stable), a Vulkan 1.3 driver, and glslc or glslangValidator (see docs/DEVELOPMENT.md for details and the optional HIP backend).

git clone https://github.com/Mechres/ocak.git
cd ocak
cargo build --release

# Get a model from Hugging Face into ~/models (owner/repo[:QUANT], default Q4_K_M)
./target/release/ocak pull unsloth/Qwen3-4B-GGUF

# Chat in the terminal (starts a private ocakd if none is running)
./target/release/ocak chat Qwen3-4B

# What does Ocak see?
./target/release/ocak hw
./target/release/ocak inspect --models-dir ~/models

# Generate from the command line (raw prompt, no chat template applied)
./target/release/ocak run --model ~/models/Qwen3.5-4B-Q4_K_M.gguf \
  --prompt "The three laws of thermodynamics are" --max-tokens 96

# Start the server
./target/release/ocakd --models-dir ~/models --port 8090

Then point any OpenAI-compatible client at http://127.0.0.1:8090/v1, open the dashboard at http://127.0.0.1:8090/ui, or use it from Claude Code:

ANTHROPIC_BASE_URL=http://127.0.0.1:8090 ANTHROPIC_API_KEY=local claude

Windows (experimental)

Windows builds target the Vulkan and CPU backends. Verified on an NVIDIA GeForce RTX 3080 Ti (Windows 11, Vulkan 1.3): Qwen3-4B Q4_K_M loads and decodes at 160 tok/s, and the server, web UI endpoint, chat and streaming work. Other GPUs and drivers are untested. Prebuilt .zip files are attached to GitHub Releases; to build from source install the Vulkan SDK (for glslangValidator) and run cargo build --release.

.\ocak.exe hw
.\ocakd.exe --models-dir C:\models --port 8090
  • The Vulkan backend needs a Vulkan 1.3 GPU with shaderFloat16, shaderInt8 and 8-bit storage support (check with vulkaninfo). Older cards such as NVIDIA Maxwell (GTX 750 Ti) lack fp16 arithmetic and are rejected; use --backend cpu there (slow, but works for small models).
  • The HIP backend (ROCm) is Linux-only; on Windows Ocak uses Vulkan, which is slower for large Mixture-of-Experts models such as Xing and Inkling.
  • GPU telemetry read from amdgpu sysfs is Linux-only, so power and temperature readings are not available on Windows.
  • Config and caches live under %USERPROFILE% (used in place of $HOME).
  • Please report problems with your GPU/driver in a GitHub issue.

Documentation

Document Contents
docs/SERVER.md API endpoints, client compatibility, tool calling, JSON mode, security, monitoring, running as a service
docs/CONFIGURATION.md ocakd / ocak options, model presets, environment variables
docs/ARCHITECTURE.md Crates, backends, KV cache, speculative decoding, batching, power management
docs/BENCHMARKS.md Full Vulkan and HIP numbers, how to measure
docs/COMPARISON.md End-to-end comparison with llama.cpp (both commit ids, method, results)
docs/DEVELOPMENT.md Building, testing, GPU checks before pushing, CI
docs/PERFORMANCE.md Performance work log: what was tried, what helped, what did not

License

MIT — see LICENSE.

About

LLM inference engine and OpenAI/Anthropic-compatible server written from scratch in Rust, with its own Vulkan compute kernels (optional HIP backend). Runs GGUF models - Inkling 2 Mini, Qwen3.5/3.8 hybrids, LFM, 29B MoE - on consumer AMD GPUs with speculative decoding and long contexts.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages