Why does the EXAONE-4.0 chat_template strip <think> with [:9] instead of [:7]?

#13
by kihunKim - opened

안녕하세요. LGAI-EXAONE/EXAONE-4.0-32B의 chat_template(Jinja)에서 아래 부분이 궁금해서 질문드립니다. ("<think>" 파싱 처리)

{%- if reasoning_content.startswith("<think>") %}
{%- set reasoning_content = reasoning_content[9:].strip() %}
{%- endif %}

일반적으로 "think" 문자열 길이는 7이라서 reasoning_content[7:]가 자연스러워 보이는데, 여기서는 9가 사용되고 있는데 혹시 이유가 따로 있을까요?


Hello! While reading the LGAI-EXAONE/EXAONE-4.0-32B chat_template (Jinja), I noticed the following logic:

{%- if reasoning_content.startswith("<think>") %}
{%- set reasoning_content = reasoning_content[9:].strip() %}
{%- endif %}

Since the literal string "<think>" is 7 characters long, I initially expected reasoning_content[7:]. However, the template uses 9

LG AI Research org

안녕하세요, 질문 주셔서 감사합니다.
EXAONE 4.0 모델은 reasoning 시 "<think>\n\n"으로 시작하도록 학습되었기 때문에 [9:] 로 작성했습니다.
말씀하신 것처럼 [7:] 로 하셔도 strip()에 의해 사라지기 때문에 동일한 결과가 나옵니다.

Hello, thank you for your attention.
EXAONE 4.0 models are trained to begin their reasoning content with "<think>\n\n", which is why we use [9:] at that point.
Using [7:] would also work, because strip() removes the leading whitespace either way, resulting in the same output.

Sign up or log in to comment