[GH-ISSUE #7967] Add stop word <|endoftext|> to qwq models #30859

Open
opened 2026-04-22 10:49:07 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @elsewhat on GitHub (Dec 6, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7967

What is the issue?

The qwq models currently go into an infinite loop.
The reasons for this appears that the model outputs <|endoftext|> at the end of its response, but ollama does not handle this as a stop word. The model therefore continues with hallucinations and goes into infinite loop.

Tested locally that the issue was resolved by using a custom model file containing

FROM qwq:latest
# Adding additional stop as otherwise the qwq model goes into an infinite loop
PARAMETER stop <|endoftext|>

OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.4.7

Originally created by @elsewhat on GitHub (Dec 6, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7967 ### What is the issue? The [qwq models](https://ollama.com/library/qwq) currently go into an infinite loop. The reasons for this appears that the model outputs <|endoftext|> at the end of its response, but ollama does not handle this as a stop word. The model therefore continues with hallucinations and goes into infinite loop. Tested locally that the issue was resolved by using a custom model file containing ``` FROM qwq:latest # Adding additional stop as otherwise the qwq model goes into an infinite loop PARAMETER stop <|endoftext|> ``` ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.4.7
GiteaMirror added the bug label 2026-04-22 10:49:07 -05:00
Author
Owner

@PaulWeinsberg commented on GitHub (Mar 3, 2025):

up

<!-- gh-comment-id:2694852267 --> @PaulWeinsberg commented on GitHub (Mar 3, 2025): up
Author
Owner

@mhidro commented on GitHub (Mar 12, 2025):

Ditto, same problem.

<!-- gh-comment-id:2716966704 --> @mhidro commented on GitHub (Mar 12, 2025): Ditto, same problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#30859