[GH-ISSUE #2405] ollama run qwen:0.5B, Reply exception, stuck in a loop. #1399

Closed
opened 2026-04-12 11:13:44 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @samzong on GitHub (Feb 8, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2405

Originally assigned to: @jmorganca on GitHub.

>>> /show info
Model details:
Family              qwen2
Parameter Size      620M
Quantization Level  Q4_0
~ uname -m -s -r
Darwin 23.3.0 arm64

image

https://github.com/ollama/ollama/assets/13782141/746225cc-9147-40e3-b7c3-d40a963fa2d5

/label bug

Originally created by @samzong on GitHub (Feb 8, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2405 Originally assigned to: @jmorganca on GitHub. ```bash >>> /show info Model details: Family qwen2 Parameter Size 620M Quantization Level Q4_0 ``` ```bash ~ uname -m -s -r Darwin 23.3.0 arm64 ``` ![image](https://github.com/ollama/ollama/assets/13782141/c1bf2750-7093-4b67-85bc-57f9d6afd7d1) https://github.com/ollama/ollama/assets/13782141/746225cc-9147-40e3-b7c3-d40a963fa2d5 /label bug
GiteaMirror added the bug label 2026-04-12 11:13:44 -05:00
Author
Owner

@bm777 commented on GitHub (Feb 8, 2024):

I had the same behavior with phi2 model. I noticed that the model gives the right or the expected answer before going to a new line (\n). So I had to add "\n" in the stop list.

const stream = await generate({
        model: "phi",
        prompt: text,
        stream: true,
        options: {
            num_predict: 70,
            temperature: 0.65,
            penalize_newline: true,
            top_p: 0.9,
            // presence_penalty: 0.6,
            stop: ["\n", "User:", "Assistant:", "User:"] //["\n"]
        }
    })

It still cuts at a wrong place sometimes, but I can manage to just remove the words after the last punctuation: . or ,
This method will not work if the user ask for a list as a result (give me 3 recipes of cappuccino) -> then after generating the first, the model will try to add a new line for the second element of the list, and it becomes more complicated to control the level.
(any workaround for this use case?)

Screenshot 2024-02-08 at 11 15 00

<!-- gh-comment-id:1933770628 --> @bm777 commented on GitHub (Feb 8, 2024): I had the same behavior with phi2 model. I noticed that the model gives the right or the expected answer before going to a new line (\n). So I had to add "\n" in the stop list. ```js const stream = await generate({ model: "phi", prompt: text, stream: true, options: { num_predict: 70, temperature: 0.65, penalize_newline: true, top_p: 0.9, // presence_penalty: 0.6, stop: ["\n", "User:", "Assistant:", "User:"] //["\n"] } }) ``` It still cuts at a wrong place sometimes, but I can manage to just remove the words after the last punctuation: . or , This method will not work if the user ask for a list as a result (give me 3 recipes of cappuccino) -> then after generating the first, the model will try to add a new line for the second element of the list, and it becomes more complicated to control the level. (any workaround for this use case?) ![Screenshot 2024-02-08 at 11 15 00](https://github.com/ollama/ollama/assets/29865600/19eca312-cc33-4d05-baad-4b994e2ce5ae)
Author
Owner

@jmorganca commented on GitHub (May 10, 2024):

The infinite generation should be fixed now. As for the poor responses from smaller models – this may be from the prompt template, prompt or other reasons – all of which we are trying to improve.

<!-- gh-comment-id:2103672593 --> @jmorganca commented on GitHub (May 10, 2024): The infinite generation should be fixed now. As for the poor responses from smaller models – this may be from the prompt template, prompt or other reasons – all of which we are trying to improve.
Author
Owner

@bm777 commented on GitHub (May 10, 2024):

@jmorganca So we should update the Ollama binary verison then right ?

<!-- gh-comment-id:2104584465 --> @bm777 commented on GitHub (May 10, 2024): @jmorganca So we should update the Ollama binary verison then right ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1399