← Home
Engine

Every kernel is in the tree

A from-scratch C++20/CUDA inference engine for GGUF and EXL3. The kernels are the product: there is no llama.cpp, ggml, Candle, PyTorch or ExLlamaV3 underneath.

What it is

An inference engine, not a wrapper around one

TinyCoder is a from-scratch C++20/CUDA inference library for NVIDIA GPUs. The kernels are the product — there is no llama.cpp, ggml, Candle, PyTorch or ExLlamaV3 underneath.

Every kernel in the tree

GGUF and EXL3 dequantisation, the int8 mma.s8.m8n8k16 stream-K GEMM, warp flash attention, the gated-delta-net recurrent kernels and the samplers are implemented in this repository. No inference library is linked, embedded or called.

C++20CUDAfrom scratch

cuBLAS is only a GEMM

cuBLAS appears as a plain GEMM and nothing else. Prefill has two paths: cuBLAS fp16 tensor cores, and the in-tree int8 stream-K MMA that quantises activations to Q8_0 and reads GGUF blocks straight from VRAM.

cuBLASint8 MMAQ8_0

Two first-class formats

GGUF v3 — K-quants Q2_K to Q6_K, Q5_0/Q5_1/Q8_0, the IQ series (IQ1_S/M, IQ2_XXS/S/XS, IQ3_XXS/S, IQ4_NL/XS), NVFP4/Q2_0 and Prism pq2_0 ternary. EXL3 — exllamav3's trellis format, read directly from a Hugging Face checkpoint directory. Model::load sniffs the format; both share the same kernels, KV cache and offload path.

GGUFEXL3IQ-seriesNVFP4PQ2_0

Model families

Qwen2.5, Qwen3.6 and Qwen3.8 — dense qwen35 and mixture-of-experts qwen35moe — plus Ornith, Gemma 4, Inkling-2-Mini (looped MoE, inkling2_loop) and Prism Ternary-Bonsai.

QwenOrnithGemma 4InklingPrism

Turing to Blackwell

Turing, Ampere, Ada and Blackwell run native SASS (sm_75 / sm_86 / sm_89 / sm_120). ./scripts/build.sh detects the GPU it is building on and adds that architecture; sm_120 needs CUDA ≥ 12.8 (verified with 13.2). The reference box is an RTX 2080 Ti with 11 GB — the MoE path splits each layer between a pinned, per-layer staged slice computed on the GPU and the rest streamed by the CPU, so the 34.4 GB Ornith-1.5-35B-A3B checkpoint runs on it.

sm_75sm_86sm_89sm_120native SASS

A CPU path that actually ships

Runtime SIMD dispatch picks AMX, AVX-512, AVX2 or a scalar fallback, with OpenMP across cores. Each loaded model gets its own CPU thread pool, so a small model can run beside a large one without borrowing its workers. Without CUDA it still runs — several times to orders of magnitude slower, and a model that does not fit in RAM will not run at all.

AMXAVX-512AVX2OpenMP
New · context · 11 GB card

Context windows sized by memory

The window is planned, not fixed: --ctx N or model.setContextLength(N) asks for N tokens, and the planner grants the largest window that fits the measured free VRAM/RAM after the weights and the session's scratch, switching to an int8 K/V store when that is what makes it fit.

The default stays 2048. A window below 1024 tokens refuses the load rather than silently truncating, and the grant is a capacity, not an accuracy claim beyond the checkpoint's trained length.

196,352tokens · Ornith-1.5-9B q4_k_m
64,256tokens · Ternary-Bonsai-2-27B
12,288tokens · Qwen3.8-27B EXL3
LoadGGUF or EXL3 — format sniffed by Model::load
PrefillcuBLAS fp16 GEMM, or in-tree int8 stream-K MMA
Decodeon-the-fly dequant GEMV · int8 KV pool
Attentionwarp flash attention + gated-delta-net recurrence
Sampletop-k / top-p / temperature / repetition penalty
New · EXL3

A second first-class format — and a measured win in both columns

EXL3 is exllamav3's trellis-quantised checkpoint format. TinyCoder loads it natively, alongside GGUF, and is faster than the reference implementation on both prefill and decode.

What EXL3 is

EXL3 stores weights as a trellis code over 16×16 (k,n) tiles in a Hugging Face safetensors directory — config.json, *.safetensors, tokenizer.json — rather than in a GGUF file. At 1.60bpw, a 27B checkpoint is 8.6 GB.

Why native support matters

Before this, an EXL3 checkpoint meant running exllamav3: PyTorch, a JIT-compiled CUDA extension, Python per token. Now the same engine runs both formats — one loader, one KV cache, one offload path, and no conversion pass.

  • Model::load detects the format and selects EXL3Loader automatically.
  • Trellis reconstruction, the EXL3 GEMV and the fused prefill GEMM live in src/cpp/core/cuda/exl3/.
  • The autotuned cublasLt path is the default; TINYCODER_EXL3_LT=0 pins the older fixed-order k summation bit-for-bit.
  • Checkpoint shape and tokenizer are read from the directory — no GGUF conversion step.
Measured · RTX 2080 Ti
725.8tok/s pp512
29.83tok/s tg128

against exllamav3 1.6.6 at 716.8 tok/s pp512 and 23.67 tok/s tg128 — same checkpoint, Qwen3.8-27B EXL3 1.60bpw, 8.6 GB.

TinyCoder leads both columns: prefill 725.8 against 716.8 (+1.3%, spreads 1.2 and 1.6), and decode 29.83 against 23.67 (+26.0%, spreads 0.06 and 0.07), three alternating interleaved pairs each. The decode margin is the mul1 dp4a fold in exl3GemvV3. A repeat session measured 30.77 / 23.63, so the between-session spread on this row is about 3% — larger than the within-session spread, but far below the decode lead. exllamav3's tg128 also includes Python per-token overhead, which makes that figure a floor rather than a best case.

Downstream integration

The VS Code extension is one consumer

The TinyCoder extension embeds tinycoder_core through its own N-API bridge — the engine's FetchContent path exists for exactly this. It adds a chat panel and editor commands on top, and it is how many people meet the engine day to day.

It is not the pitch. The library is the product; the extension is a downstream integration that proves the embedding path works.

TinyCoder extension
How it embeds
  1. FetchContent pulls the engine and links tinycoder_core.
  2. The extension adds an N-API bridge over the C++ Model.
  3. VS Code renders chat and commands over that bridge.