Bug Report: Chat Template {today} and {yesterday} Variables Not Substituted

#1
by kkosm - opened

Summary

The chat template contains {today} and {yesterday} placeholders in the default system message that are never substituted, causing the model to hallucinate dates.

Details

The template's default_system_message contains:

The current date is {today}.
...
(e.g. "yesterday" is {yesterday})

These are Python-style format placeholders inside a Jinja string literal. They expect the calling application to perform string substitution before Jinja rendering. However, llama.cpp passes the literal {today} text to the model.

Reproduction

llama-cli -hf unsloth/Ministral-3-3B-Instruct-2512-GGUF:Q4_K_XL --conversation
> What day is it?
# Model responds with hallucinated date (e.g., "June 5, 2024")

Suggested Fix

Replace Python-style placeholders with llama.cpp-compatible Jinja:

{%- set today = strftime_now('%Y-%m-%d') %}
{%- set default_system_message = '...The current date is ' + today + '...' %}

Note: {yesterday} cannot be fixed as minja lacks date arithmetic. Consider removing that reference or simplifying to just use today.

Environment

  • llama.cpp build 7270
  • Model: unsloth/Ministral-3-3B-Instruct-2512-GGUF:Q4_K_XL

Sign up or log in to comment