Downloads · 30 days
0
arbv/gpt-oss-fixed-jinja-template
gpt-oss-fixed-jinja-template is a machine learning model from arbv. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This repository provides a hardened version of the chattemplate.jinja for the GPT-OSS (20B and 120B) models.
Downloads · 30 days
0
Access
Public
Updated Oct 2, 2026
Repo size
—
Likes
5
Trending 1
Click a slice to open those files.
.jinja21.3 KB · 61%
From the Hugging Face model README
This repository provides a hardened version of the chat_template.jinja for the GPT-OSS (20B and 120B) models.
The template is based on the Unsloth version and incorporates related optimisations and fixes from both Unsloth and ggml-org.
Beyond these base improvements, this version has been further hardened to eliminate additional corner-case failures.
Specifically, it resolves TypeError crashes caused by the concatenation of null values in the content and thinking fields, and prevents IndexError exceptions occurring from empty tool_calls arrays. Also fixes a bug introduced by Unsloth when replaying history against the template would end-up in analysis (thinking) blocks rendered while answers themselves are dropped.
The template includes security checks to prevent token smuggling and prompt injection across all roles. The checks are active by default but can be disabled via the allow_injection kwarg parameter (defaults to false).
Also, by default the template steers the model to reason in a more dense and less verbose style. It is controlled by dense_reasoning kwarg parameter (defaults to true). This functionality works better on the 120B variant of the model.
Additionally, historical reasoning retention across turns is controlled via the preserve_thinking kwarg parameter (defaults to false). When set to false, reasoning traces are purged to minimise context window consumption in accordance with the canonical Harmony specification. Setting it to true preserves reasoning across both conversational turns and intermediate tool calls, enforcing an append-only token sequence that prevents KV prefix cache invalidation in multi-turn inference. The option is an experimental one, because the model likely was not specifically trained for that.
This implementation has only been tested on llama.cpp, but it should work everywhere where the Jinja2 engine supports is string.
This implementation incorporates contributions from OpenAI (original version), Unsloth, ggml-org, Dimon Dev, skeole, and Artem Boldariev.
This project is released under the Apache 2.0 License.