this template will lower inference speed?

#76
by jasonot - opened

On my 16 GB GPU, inference speed is 25‑35 TPS with this template, versus 35‑45 TPS without it

【【--jinja --chat-template-file "D:\OllamaModels\chat_template.jinja" ^】】

I:\models\llama-b10435-bin-win-cuda-13.3-x64\llama-server.exe ^
--model D:\OllamaModels\Qwen3.8-27B-IQ4_XS.gguf ^
--jinja --chat-template-file "D:\OllamaModels\chat_template.jinja" ^
--reasoning-preserve ^
--chat-template-kwargs "{"reasoning_effort":"medium"}" ^
-fa on ^
-fit off ^
-ngl 99 ^
-ctk q4_0 ^
-ctv q4_0 ^
-lv 4 ^
--gpu-layers-draft all ^
--spec-type draft-mtp ^
--spec-draft-n-max 2 ^
--no-mmproj ^
-np 1 ^
--temp 1.0 ^
--top-p 0.95 ^
--top-k 20 ^
--min-p 0.0 ^
--presence-penalty 0.0 ^
--repeat-penalty 1.0 ^
--load-mode none ^
--no-warmup ^
-b 512 ^
-ub 256 ^
-c 18304 ^
--parallel 1 ^
--host 0.0.0.0 ^
--port 9931
pause

Thanks for the report.

The speed difference you are seeing between thinking and non-thinking generation in llama-server is architectural rather than a template bottleneck.

When the model reasons, token entropy is noticeably higher and less predictable than during standard text generation. If you are using speculative decoding or Multi-Token Prediction (MTP) draft models, the acceptance rate of speculative tokens drops significantly during reasoning blocks, which lowers effective tokens per second. Once the model leaves the block and begins emitting regular response text, speculative acceptance rates recover.

The template Jinja AST is fully flattened, so template evaluation overhead during prompt processing is negligible. If you are connecting coding agents to llama-server, I recommend running with --reasoning-format deepseek and --reasoning-preserve to ensure reasoning content is routed cleanly and prefix KV cache hits stay at 100%.

Sign up or log in to comment