diff --git a/llama.cpp b/llama.cpp index c431f769e..a7d53d890 100644 --- a/llama.cpp +++ b/llama.cpp @@ -9037,7 +9037,7 @@ static int llama_decode_internal( // decide if we need to defrag the kv cache if (cparams.defrag_thold >= 0.0f) { - const float fragmentation = kv_self.n >= 128 ? 1.0f - float(kv_self.used + n_tokens_all)/float(kv_self.n) : 0.0f; + const float fragmentation = kv_self.n >= 128 ? 1.0f - float(kv_self.used)/float(kv_self.n) : 0.0f; // queue defragmentation for next llama_kv_cache_update if (fragmentation > cparams.defrag_thold) {