Safetensors
French
English
nemotron
openllm-france

Prime the opening <think> in the generation prompt and remove enable_thinking

#2
by Jeronymous - opened
Files changed (2) hide show
  1. README.md +5 -3
  2. chat_template.jinja +4 -4
README.md CHANGED
@@ -106,11 +106,12 @@ Okay, the user is asking who Molière was, and they want a concise answer. Let m
106
  Jean-Baptiste Poquelin, known as Molière, was a 17th-century French playwright, actor, and poet. Born in Paris in 1622, … <|im_end|>
107
  ```
108
 
109
- Thinking can be turned off by using ```tokenizer.apply_chat_template(…, enable_thinking=False)```. This will append empty thinking tags (```<think>\n\n</think>\n\n```) in the prompt, immediately after "`assistant\n`".
110
- However, for testing a non-thinking model, it is better to conduct experiments on [Luciole-8B-Instruct-1.1](https://huggingface.co/OpenLLM-France/Luciole-8B-Instruct-1.1).
111
 
112
  By default, the `<think>…</think>` reasoning of all previous assistant turns is kept when formatting a multi-turn conversation. Setting ```tokenizer.apply_chat_template(…, preserve_thinking=False)``` drops it from every assistant turn preceding the last user message (only the most recent turn keeps its reasoning), which shortens the prompt and reduces the KV-cache footprint. With vLLM, set it per request via ```extra_body={"chat_template_kwargs": {"preserve_thinking": false}}```. Ollama does not use this parameter, as it formats prompts with its own built-in renderer.
113
 
 
 
114
  ### Training procedure
115
 
116
  Luciole-8B-KD-Math-Thinking-1.1 was trained in two phases. The model was first finetuned on thinking data, followed by DPO on preference data with thinking traces.
@@ -186,7 +187,8 @@ docker run --runtime nvidia --gpus=all \
186
  -p 8000:8000 \
187
  --ipc=host \
188
  vllm/vllm-openai:latest \
189
- --model OpenLLM-France/Luciole-8B-KD-Math-Thinking-1.1
 
190
  ```
191
 
192
  #### 2. Test using OpenAI Client in Python
 
106
  Jean-Baptiste Poquelin, known as Molière, was a 17th-century French playwright, actor, and poet. Born in Paris in 1622, … <|im_end|>
107
  ```
108
 
109
+ For a non-thinking model, use [Luciole-8B-Instruct-1.1](https://huggingface.co/OpenLLM-France/Luciole-8B-Instruct-1.1) instead.
 
110
 
111
  By default, the `<think>…</think>` reasoning of all previous assistant turns is kept when formatting a multi-turn conversation. Setting ```tokenizer.apply_chat_template(…, preserve_thinking=False)``` drops it from every assistant turn preceding the last user message (only the most recent turn keeps its reasoning), which shortens the prompt and reduces the KV-cache footprint. With vLLM, set it per request via ```extra_body={"chat_template_kwargs": {"preserve_thinking": false}}```. Ollama does not use this parameter, as it formats prompts with its own built-in renderer.
112
 
113
+ The chat template prefills the opening `<think>` tag in the generation prompt, so the model's output starts directly with the reasoning and contains only the closing `</think>` (reasoning, then `</think>`, then the answer). When serving with vLLM, add `--reasoning-parser qwen3` so the reasoning is returned separately in `reasoning_content` and the final answer in `content` (SGLang uses the same `--reasoning-parser qwen3`). This requires a recent vLLM (≥ 0.24; prefer the latest).
114
+
115
  ### Training procedure
116
 
117
  Luciole-8B-KD-Math-Thinking-1.1 was trained in two phases. The model was first finetuned on thinking data, followed by DPO on preference data with thinking traces.
 
187
  -p 8000:8000 \
188
  --ipc=host \
189
  vllm/vllm-openai:latest \
190
+ --model OpenLLM-France/Luciole-8B-KD-Math-Thinking-1.1 \
191
+ --reasoning-parser qwen3
192
  ```
193
 
194
  #### 2. Test using OpenAI Client in Python
chat_template.jinja CHANGED
@@ -1,6 +1,9 @@
1
  {%- if preserve_thinking is not defined %}
2
  {%- set preserve_thinking = true %}
3
  {%- endif %}
 
 
 
4
  {%- if messages[0].role == 'system' and messages[0].content.strip() != "" %}
5
  {%- set system_message = messages[0].content %}
6
  {%- else %}
@@ -84,8 +87,5 @@
84
  {%- endif %}
85
  {%- endfor %}
86
  {%- if add_generation_prompt %}
87
- {{- '<|im_start|>assistant\n' }}
88
- {%- if enable_thinking is defined and enable_thinking is false %}
89
- {{- '<think>\n\n</think>\n\n' }}
90
- {%- endif %}
91
  {%- endif %}
 
1
  {%- if preserve_thinking is not defined %}
2
  {%- set preserve_thinking = true %}
3
  {%- endif %}
4
+ {%- if enable_thinking is defined and enable_thinking is false %}
5
+ {{- raise_exception('Disabling thinking (enable_thinking=False) is not supported by this model. For a non-thinking model, use an OpenLLM-France Luciole Instruct model.') }}
6
+ {%- endif %}
7
  {%- if messages[0].role == 'system' and messages[0].content.strip() != "" %}
8
  {%- set system_message = messages[0].content %}
9
  {%- else %}
 
87
  {%- endif %}
88
  {%- endfor %}
89
  {%- if add_generation_prompt %}
90
+ {{- '<|im_start|>assistant\n<think>\n' }}
 
 
 
91
  {%- endif %}