Skip to main content
Serve any fine-tuned GGUF over an OpenAI-compatible HTTP endpoint. For Gemma-4, add MTP to get lossless 1.4–2.2× faster generation — no drafter retraining, one flag.

Quick Start

1

Serve a trained model

Point at a GGUF and get an OpenAI-compatible endpoint on 127.0.0.1:8080.
2

Use it from any OpenAI client

The endpoint is OpenAI-compatible, so praisonaiagents (and every other OpenAI SDK) talks to it out of the box.
3

Benchmark and see the MTP win

--benchmark is a one-shot: it prints tokens-per-second plus draft acceptance for Gemma-4, then exits.
4

Export the GGUF with its MTP drafter

Pass --mtp-draft when exporting a Gemma-4 model — the stock drafter is fetched and placed next to the GGUF so serve picks it up automatically.

How It Works

MTP proposes several tokens with a small drafter, then the fine-tuned model verifies them in one pass — so the output is bitwise identical to plain serving. The drafter is a separate artifact and is never contained in a plain q4_K_M GGUF — that is why the fetch step exists. Verification is done by the fine-tuned target model, so the generation is lossless: identical output, fewer forward passes.

Configuration Options

Two surfaces: CLI flags on serve, and config-file keys the trainer accepts when you export --mtp-draft.

CLI flags — praisonai-train serve

Provide either --gguf or --model-dir to pick the target.
Provide --gguf or --model-dir — without either, serve exits with Nothing to serve: provide --gguf or --model-dir. The server binds to 127.0.0.1 (there is no --host flag).

Config keys — export --mtp-draft

These keys are accepted by the trainer’s config (config.yaml) alongside export.
mtp_draft_repo and mtp_draft_file are recognized config keys reserved for a custom drafter; the current fetch path resolves the repo and filename automatically from the Gemma-4 family + size.

Common Patterns

Serve any GGUF (non-Gemma-4)

Plain serving works for every fine-tuned model. A non-Gemma family falls back to plain serving with a clear message.

Serve from a model directory

Point at a directory and the target GGUF is auto-detected (drafter files are skipped).

Benchmark before you ship

--benchmark prints raw tokens/sec and (for Gemma-4) draft acceptance in one line — confirm the MTP win on your box before flipping traffic over.

Talk to it from praisonaiagents

Any Agent that already speaks OpenAI works — point base_url at http://<host>:<port>/v1.

Supported models

Only Gemma-4 ships a stock MTP drafter. Verified mapping (from _mtp.py): The drafter precision is Q8_0 by default; bf16 and f16 variants resolve to BF16 / F16 filenames. Non-Gemma models (Llama / Qwen / Mistral / Phi / DeepSeek) do not ship MTP drafters. serve --gguf still works on them — just without the speculative-decoding pathway. Do not expect a 1.4× on a Qwen fine-tune.

Field notes

Runtime maturity. Gemma-4 E4B (MatFormer / per-layer-embedding arch) currently loads but stalls on generation in mainline llama.cpp b10107 across CPU / Vulkan / CUDA on the validation box. The feature is correct and ready; it lights up as llama.cpp’s E4B support matures and for the other sizes. Measured MTP speedup via the canonical HF-Transformers assistant_model path (E4B, one A6000, transformers 5.14.1): 7.04 → 9.86 tok/s = 1.40×, within Unsloth’s quoted 1.4–2.2× band.
Old GGUF converters may be incompatible. A q4_K_M GGUF exported by an older converter may be tensor-incompatible with current llama.cpp. Re-export from merged weights with an up-to-date converter before serving.
llama.cpp is required at runtime. The serve path shells out to llama-server (auto-discovered via find_llama_binary(), or set LLAMA_CPP_BIN). Grab a build from llama.cpp releases — Homebrew, apt, or a manual cmake -B build && cmake --build build all work. MTP needs the --spec-type draft-mtp support from ggml-org/llama.cpp#25148.
“Lossless” means bitwise-identical. MTP only changes how the tokens are produced (draft + verify), not which tokens — a served GGUF returns the same output as plain serving. The 1.4× figure above is measured on the HF-Transformers path; the llama.cpp path lights up as its Gemma-4 support matures.

Best Practices

--benchmark catches drafter compatibility and llama.cpp version drift before real traffic hits the endpoint. Run it once on your box, confirm the tok/s and draft-acceptance line, then serve.
--mtp-draft on export adds a ~95 MB artifact next to your GGUF. Leave it off for size-constrained deploys — you can always fetch the drafter later by serving with --mtp-draft (the default).
The default Q8_0 drafter fits comfortably on CPU inference. For edge devices, consider a smaller variant if a matching one is published upstream.
Any GGUF from praisonai-train export gguf can be served by this command — MTP is the bonus, not the point. A non-Gemma family falls back to plain serving with a clear message.

Train

Training overview and fine-tuning setup.

Train CLI

Full flag reference for every subcommand.

praisonai-train Package

The standalone package guide.

Speed Benchmark

Rank deployments by generation speed (distinct from serve --benchmark).

Multi-GPU Training

Fine-tune across multiple GPUs with torchrun.

Installation Extras

The train install matrix.