diff options
Diffstat (limited to 'llm.c')
| -rw-r--r-- | llm.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -257,6 +257,14 @@ void llm_run(struct llm_ctx *llm, const char *user_prompt, FILE *out) syslog(LOG_WARNING, "cached prefix is shorter than the system prompt"); } + /* Force at least one real decode every request. If n_common hit + * n_new_tokens, decode gets skipped entirely, so ctx keeps the + * stale logits from the previous request's EOG -- sampling them + * again just reproduces EOG immediately (empty response on an + * exact repeat). */ + if (n_common == n_new_tokens) + n_common--; + /* Drop everything in the cache past the common prefix. */ llama_memory_seq_rm(llama_get_memory(llm->ctx), 0, /* sequence id: 0 - we only use one sequence */ |
