[GH-ISSUE #295] stop parameter values don't always stop generation #131

Closed
opened 2026-04-12 09:39:43 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @jmorganca on GitHub (Aug 6, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/295

Originally assigned to: @jmorganca on GitHub.

Stop words don't always stop generation

Originally created by @jmorganca on GitHub (Aug 6, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/295 Originally assigned to: @jmorganca on GitHub. Stop words don't always stop generation
GiteaMirror added the bug label 2026-04-12 09:39:43 -05:00
Author
Owner

@mxyng commented on GitHub (Aug 7, 2023):

Do you have an example of where stop words failed to stop generation? i.e. a Modelfile with PARAMETER stop <something> and an output using the model where the output shows <something>?

<!-- gh-comment-id:1668265079 --> @mxyng commented on GitHub (Aug 7, 2023): Do you have an example of where stop words failed to stop generation? i.e. a Modelfile with `PARAMETER stop <something>` and an output using the model where the output shows `<something>`?
Author
Owner

@sqs commented on GitHub (Aug 30, 2023):

@jmorganca Here is an example of where the stop param was given but Ollama failed to stop generation:

% curl -d '{"prompt":"const primes=[1,2,3,","model":"codellama:7b","options":{"num_ctx":100,"stop":["\n"]}}' http://localhost:11434/api/generate
{"model":"codellama:7b","created_at":"2023-08-30T04:14:43.730248Z","response":" I","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:43.780393Z","response":" believe","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:43.829942Z","response":" you","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:43.879305Z","response":" meant","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:43.928631Z","response":" to","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:43.978099Z","response":" write","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.028311Z","response":":","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.12742Z","response":"\n import","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.177132Z","response":" math","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.276432Z","response":"\n pr","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.326199Z","response":"imes","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.376749Z","response":" =","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.427742Z","response":" []","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.527658Z","response":"\n for","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.577572Z","response":" i","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.628179Z","response":" in","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.679126Z","response":" range","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.73Z","response":"(","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.781045Z","response":"1","done":false}
{"model":"codellama:7b","created_at":"2023-08-30T04:14:44.831974Z","response":"0","done":false}
^C

Running on the latest version of ollama (just updated) on macOS.

<!-- gh-comment-id:1698462925 --> @sqs commented on GitHub (Aug 30, 2023): @jmorganca Here is an example of where the `stop` param was given but Ollama failed to stop generation: ``` % curl -d '{"prompt":"const primes=[1,2,3,","model":"codellama:7b","options":{"num_ctx":100,"stop":["\n"]}}' http://localhost:11434/api/generate {"model":"codellama:7b","created_at":"2023-08-30T04:14:43.730248Z","response":" I","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:43.780393Z","response":" believe","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:43.829942Z","response":" you","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:43.879305Z","response":" meant","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:43.928631Z","response":" to","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:43.978099Z","response":" write","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.028311Z","response":":","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.12742Z","response":"\n import","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.177132Z","response":" math","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.276432Z","response":"\n pr","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.326199Z","response":"imes","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.376749Z","response":" =","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.427742Z","response":" []","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.527658Z","response":"\n for","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.577572Z","response":" i","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.628179Z","response":" in","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.679126Z","response":" range","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.73Z","response":"(","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.781045Z","response":"1","done":false} {"model":"codellama:7b","created_at":"2023-08-30T04:14:44.831974Z","response":"0","done":false} ^C ``` Running on the latest version of ollama (just updated) on macOS.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#131