You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: format_jinja() hardcodes eos_token="", stripping </s> from all Mistral chat templates and causing multi-turn loops #2644
Why this breaks all Mistral models (Mistral-7B, Ministral-8B, Mistral-Small, Mistral-Large)
Unlike Qwen (<|im_end|>) or Gemma (<end_of_turn>), which hardcode their end-of-turn literals directly in the Jinja string, Mistral's official Hugging Face chat_template uses the eos_token variable at the end of every assistant turn:
Because format_jinja() passes eos_token="", every assistant reply in multi-turn history has its </s> (token ID 2) stripped ([/INST]assistant reply[INST]next user msg[/INST]). In multi-turn chat, seeing 10+ historical turns with zero </s> tokens conditions the model to never emit </s>, causing runaway paragraph looping and failure to stop.
Verification / Fix
Replacing eos_token with the literal '</s>' in a custom jinjatemplate (or passing the model's actual EOS token string into jinja_compiled_template.render()) immediately restores token ID 2 between turns and triggers (EOS token triggered! ID:2) cleanly without looping.
Activity