diff --git a/src/llama-memory-recurrent.cpp b/src/llama-memory-recurrent.cpp index 9213ac1dc..2bb8ef18c 100644 --- a/src/llama-memory-recurrent.cpp +++ b/src/llama-memory-recurrent.cpp @@ -666,7 +666,7 @@ bool llama_memory_recurrent::find_slot(const llama_ubatch & ubatch) { const int32_t cell_id = s + min; auto & cell = cells[cell_id]; - if (cell.pos >= 0 && last_pos != cell.pos + (llama_pos) n_seq_tokens) { + if (ubatch.n_pos == 1 && cell.pos >= 0 && last_pos != cell.pos + (llama_pos) n_seq_tokens) { // What should happen when the pos backtracks or skips a value? // Clearing the state mid-batch would require special-casing which isn't done. LLAMA_LOG_WARN("%s: non-consecutive token position %d after %d for sequence %d with %u new tokens\n",